mauricioadl 12 de jul. de 2011
ja tentou usar o metodo setDate? ex:
stmt.[b]setDate/b ;
rafaelpiton 12 de jul. de 2011
tentei,
só que fica marcado em vermelho informando que tem erro…
mauricioadl 12 de jul. de 2011
pode ser problema no import, por isso fica vermelho ou seu parametro (cabecalho.get$07_DataDeEmissao()) nao esta retornando um Date
verifica os dois casos, se o import esta correto java.util.Date e nao o java.sql.Date e se seu atributo esta trazendo um Date mesmo.
rafaelpiton 12 de jul. de 2011
é string que ta vindo…
e acabei não colocando todo o erro…
java . lang . IllegalArgumentException : Cannot format given Object as a Date
at java . text . DateFormat . format ( Unknown Source )
at java . text . Format . format ( Unknown Source )
mauricioadl 12 de jul. de 2011
como que ta a string com a data, voce precisa formata-la antes de enviar para o banco;
algo do tipo:
String suaData = “19/09/1984”
pelo banco de dados:
String sql = “Insert into tabela (campo_date) values to_date(”’+data+’",‘dd/mm/yyyy’)";
pelo java :
DateFormat formatter = new SimpleDateFormat ( “ dd / MM / yyyy ” );
date = new java . sql . Date ( (( java . util . Date ) formatter . parse ( suaData )). getTime () );
ae depois vc chama como setDate ().
entendeu?
rubens_inf 11 de mai. de 2012
Desenterrei esse tópico galera, estou com o mesmo erro, no banco vem como string e no java está como Date! me da esse erro.
estou usando vrptor 3.4.1 e extJs 4.
14 : 48 : 31 , 777 DEBUG [ DefaultExceptionMapper ] find for exception class java . lang . IllegalArgumentException
Mai 11 , 2012 2 : 48 : 31 PM org . apache . catalina . core . StandardWrapperValve invoke
Grave : Servlet . service () for servlet default threw exception
br . com . caelum . vraptor . InterceptionException : exception raised , check root cause for details : java . lang . IllegalArgumentException : Cannot format given Object as a Date
at br . com . caelum . vraptor . interceptor . ExecuteMethodInterceptor . intercept ( ExecuteMethodInterceptor . java : 96 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . core . LazyInterceptorHandler . execute ( LazyInterceptorHandler . java : 61 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . core . LazyInterceptorHandler . execute ( LazyInterceptorHandler . java : 61 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . ExceptionHandlerInterceptor . intercept ( ExceptionHandlerInterceptor . java : 71 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . InstantiateInterceptor . intercept ( InstantiateInterceptor . java : 48 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . FlashInterceptor . intercept ( FlashInterceptor . java : 83 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . ParametersInstantiatorInterceptor . intercept ( ParametersInstantiatorInterceptor . java : 93 )
at br . com . caelum . vraptor . core . LazyInterceptorHandler . execute ( LazyInterceptorHandler . java : 59 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . ResourceLookupInterceptor . intercept ( ResourceLookupInterceptor . java : 69 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 56 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . core . EnhancedRequestExecution . execute ( EnhancedRequestExecution . java : 44 )
at br . com . caelum . vraptor . VRaptor $ 1. insideRequest ( VRaptor . java : 91 )
at br . com . caelum . vraptor . ioc . spring . SpringProvider . provideForRequest ( SpringProvider . java : 58 )
at br . com . caelum . vraptor . VRaptor . doFilter ( VRaptor . java : 88 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 235 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 206 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 378 )
at org . springframework . security . intercept . web . FilterSecurityInterceptor . invoke ( FilterSecurityInterceptor . java : 109 )
at org . springframework . security . intercept . web . FilterSecurityInterceptor . doFilter ( FilterSecurityInterceptor . java : 83 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 390 )
at org . springframework . security . ui . SessionFixationProtectionFilter . doFilterHttp ( SessionFixationProtectionFilter . java : 67 )
at org . springframework . security . ui . SpringSecurityFilter . doFilter ( SpringSecurityFilter . java : 53 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 390 )
at org . springframework . security . ui . ExceptionTranslationFilter . doFilterHttp ( ExceptionTranslationFilter . java : 101 )
at org . springframework . security . ui . SpringSecurityFilter . doFilter ( SpringSecurityFilter . java : 53 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 390 )
at org . springframework . security . wrapper . SecurityContextHolderAwareRequestFilter . doFilterHttp ( SecurityContextHolderAwareRequestFilter . java : 91 )
at org . springframework . security . ui . SpringSecurityFilter . doFilter ( SpringSecurityFilter . java : 53 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 390 )
at org . springframework . security . ui . AbstractProcessingFilter . doFilterHttp ( AbstractProcessingFilter . java : 277 )
at org . springframework . security . ui . SpringSecurityFilter . doFilter ( SpringSecurityFilter . java : 53 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 390 )
at org . springframework . security . ui . logout . LogoutFilter . doFilterHttp ( LogoutFilter . java : 89 )
at org . springframework . security . ui . SpringSecurityFilter . doFilter ( SpringSecurityFilter . java : 53 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 390 )
at org . springframework . security . context . HttpSessionContextIntegrationFilter . doFilterHttp ( HttpSessionContextIntegrationFilter . java : 235 )
at org . springframework . security . ui . SpringSecurityFilter . doFilter ( SpringSecurityFilter . java : 53 )
at org . springframework . security . util . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 390 )
at org . springframework . security . util . FilterChainProxy . doFilter ( FilterChainProxy . java : 175 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 237 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 167 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 235 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 206 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 233 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 191 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 127 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 102 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 109 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 293 )
at org . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 859 )
at org . apache . coyote . http11 . Http11Protocol $ Http11ConnectionHandler . process ( Http11Protocol . java : 602 )
at org . apache . tomcat . util . net . JIoEndpoint $ Worker . run ( JIoEndpoint . java : 489 )
at java . lang . Thread . run ( Unknown Source )
Caused by : java . lang . IllegalArgumentException : Cannot format given Object as a Date
at java . text . DateFormat . format ( Unknown Source )
at java . text . Format . format ( Unknown Source )
at org . cinemotion . controller . ConfiguracaoFuncController . salvar ( ConfiguracaoFuncController . java : 42 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )