java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date

Oracle Community | User_OIM | 4 years ago
  1. 0

    OIM 10g ERROR: Java.sql.TimeStamp cannot be cast to java.sql.date

    Oracle Community | 4 years ago | User_OIM
    java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date
  2. 0

    Hi, Working on some plugin dev for JIRA 5. Our UserVoice integration uses active objects. When [the AO 0.18.x Upgrade Guide|https://developer.atlassian.com/display/AO/AO+0.18.x+Upgrade+Guide] was documented last fall, we decided to wait until RC3 to refactor the couple of tables. This week I was able to begin said, as far as we can tell from the [removed types|https://developer.atlassian.com/display/AO/AO+0.18.x+Upgrade+Guide#AO0.18.xUpgradeGuide-RemovedTypes] section, we need to refactor instances of java.sql.Timestamp to instead use java.sql.Date with our ao Entity classes. This change appears pretty trivial, but we're running into ClassCastExceptions that appear to be generated by the AO library. This is when running the new code against a clean install. So, I'm wondering if there's something missing in my understanding of what you're expecting us to refactor? Here are some relevant code chunks: *The refactored entity that's having a problem* {code} package com.appfusions.jira.uservoice.entity; import java.sql.Date; import net.java.ao.Entity; import net.java.ao.Preload; @Preload public interface CommentMap extends Entity { long getJiraCommentId(); void setJiraCommentId(long id); int getUserVoiceMappingId(); void setUserVoiceMappingId(int id); Date getLastUpdateTime(); void setLastUpdateTime(Date time); } {code} *code that triggers the exception.* {code} CommentMap[] mappings = ao.find(CommentMap.class, "USER_VOICE_MAPPING_ID = ?", message.getId()); ... Object lastUpdateObj = mappings[0].getLastUpdateTime(); {code} *The Stack trace* {code} [INFO] [talledLocalContainer] 2012-01-31 12:07:47,015 ERROR [com.atlassian.jira.service.ServiceRunner] - <An error occured while trying to run service 'UserVoice Service'. java.sql.Timestamp cannot be cast to java.sql.Date> [INFO] [talledLocalContainer] java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date [INFO] [talledLocalContainer] at $Proxy1422.getLastUpdateTime(Unknown Source) [INFO] [talledLocalContainer] at com.appfusions.jira.uservoice.manager.impl.DefaultUserVoiceTicketManager.isMappedMessageNewer(DefaultUserVoiceTicketManager.java:122) [INFO] [talledLocalContainer] at com.appfusions.jira.uservoice.service.sync.UserVoiceHelpdeskSyncController.doSync(UserVoiceHelpdeskSyncController.java:124) [INFO] [talledLocalContainer] at com.appfusions.jira.uservoice.service.UserVoiceSyncService.run(UserVoiceSyncService.java:44) [INFO] [talledLocalContainer] at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61) {code} *We're setting the version of JIRA and the AO library version in the pom like so:* {code} <jira.version>5.0-rc3</jira.version> <ao.version>0.19.3</ao.version> {code} I chose 0.19.3 because that appears to be the latest version of the AO library. We have run atlas-clean and used a fresh data set, new configuration, etc. between tests, so I do not think it could be old tables. They are blown away every time. Oddly nothing bad seems to happen when we call setLastUpdateTime. Any ideas what we're doing wrong? Or is this a bug? Thanks!

    Ecosystem JIRA | 5 years ago | Laura Kolker [AppFusions]
    java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date
  3. 0

    JDBC Date/Time issues

    Oracle Community | 8 years ago | 843859
    java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Apache Spark User List - [Spark SQL 1.3.1] data frame saveAsTable returns exception

    nabble.com | 1 year ago
    java.lang.ClassCastException: java.sql.Date cannot be cast to java.lang.Integer
  6. 0

    Converting String into SQl Date format

    Stack Overflow | 3 years ago | Nav
    java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.sql.Timestamp cannot be cast to java.sql.Date

      at com.thortech.xl.dataobj.util.tcDefaultDataUtil.setDefaultData()
    2. com.thortech.xl
      tcProvisioningOperationsSession.updateTask
      1. com.thortech.xl.dataobj.util.tcDefaultDataUtil.setDefaultData(Unknown Source)
      2. com.thortech.xl.dataobj.util.tcDefaultDataUtil.<init>(Unknown Source)
      3. com.thortech.xl.dataobj.util.tcOrderPackages.computeProcessFormData(Unknown Source)
      4. com.thortech.xl.dataobj.util.tcOrderPackages.createOrder(Unknown Source)
      5. com.thortech.xl.dataobj.util.tcOrderPackages.orderPackageForOrganization(Unknown Source)
      6. com.thortech.xl.dataobj.tcOIO.provision(Unknown Source)
      7. com.thortech.xl.dataobj.tcOIO.eventPostInsert(Unknown Source)
      8. com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
      9. com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
      10. com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
      11. com.thortech.xl.dataobj.tcOBI.checkApproved(Unknown Source)
      12. com.thortech.xl.dataobj.tcOBI.eventPostUpdate(Unknown Source)
      13. com.thortech.xl.dataobj.tcDataObj.update(Unknown Source)
      14. com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
      15. com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
      16. com.thortech.xl.dataobj.tcOBI.approve(Unknown Source)
      17. com.thortech.xl.dataobj.tcORC.checkOrcTarget(Unknown Source)
      18. com.thortech.xl.dataobj.tcORC.eventPostUpdate(Unknown Source)
      19. com.thortech.xl.dataobj.tcDataObj.update(Unknown Source)
      20. com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
      21. com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
      22. com.thortech.xl.dataobj.tcORC.setOrderContentItemStatus(Unknown Source)
      23. com.thortech.xl.dataobj.tcORC.setOrderContentItemStatus(Unknown Source)
      24. com.thortech.xl.dataobj.tcScheduleItem.checkOrderContentItem(Unknown Source)
      25. com.thortech.xl.dataobj.tcScheduleItem.eventPostUpdate(Unknown Source)
      26. com.thortech.xl.dataobj.tcDataObj.update(Unknown Source)
      27. com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
      28. com.thortech.xl.adapterfactory.events.tcAdpEvent.updateSchItem(Unknown Source)
      29. com.thortech.xl.adapterfactory.events.tcAdpEvent.finalizeProcessAdapter(Unknown Source)
      30. com.thortech.xl.adapterfactory.events.tcAdpEvent.finalizeAdapter(Unknown Source)
      31. com.thortech.xl.adapterGlue.ScheduleItemEvents.adpCHECKVALUE.implementation(adpCHECKVALUE.java:55)
      32. com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
      33. com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
      34. com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(Unknown Source)
      35. com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(Unknown Source)
      36. com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
      37. com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
      38. com.thortech.xl.dataobj.tcScheduleItem.insertResponseMilestones(Unknown Source)
      39. com.thortech.xl.dataobj.tcScheduleItem.eventPostUpdate(Unknown Source)
      40. com.thortech.xl.dataobj.tcDataObj.update(Unknown Source)
      41. com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
      42. com.thortech.xl.ejb.beansimpl.tcProvisioningOperationsBean.updateTask(Unknown Source)
      43. com.thortech.xl.ejb.beansimpl.tcProvisioningOperationsBean.updateTask(Unknown Source)
      44. com.thortech.xl.ejb.beans.tcProvisioningOperationsSession.updateTask(Unknown Source)
      44 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1181.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    4. JBoss Application Server Server
      StatelessSessionContainer$ContainerInterceptor.invoke
      1. org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      2. org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
      2 frames
    5. JBoss Application Server Connector
      CachedConnectionInterceptor.invoke
      1. org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
      1 frame
    6. JBoss Application Server Server
      Container.invoke
      1. org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
      2. org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      3. org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      4. org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      5. org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      6. org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
      7. org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      8. org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
      9. org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
      10. org.jboss.ejb.Container.invoke(Container.java:960)
      10 frames
    7. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    8. org.jboss.mx
      ReflectedDispatcher.invoke
      1. org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      1 frame
    9. JBoss Application Server J2SE
      MBeanServerImpl.invoke
      1. org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      2. org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      3. org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      4. org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      4 frames
    10. JBoss Application Server Server
      ClientContainer.invoke
      1. org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
      2. org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
      3. org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
      4. org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
      5. org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
      6. org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
      7. org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
      8. org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
      8 frames
    11. Unknown
      $Proxy332.updateTask
      1. $Proxy332.updateTask(Unknown Source)
      1 frame
    12. Thor.API.Operations
      tcProvisioningOperationsClient.updateTask
      1. Thor.API.Operations.tcProvisioningOperationsClient.updateTask(Unknown Source)
      1 frame
    13. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1180.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    14. Thor.API.Base
      SecurityInvocationHandler$1.run
      1. Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
      1 frame
    15. Thor.API.Security
      jbossLoginSession.runAs
      1. Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source)
      1 frame
    16. Thor.API.Base
      SecurityInvocationHandler.invoke
      1. Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
      1 frame
    17. Unknown
      $Proxy792.updateTask
      1. $Proxy792.updateTask(Unknown Source)
      1 frame
    18. com.thortech.xl
      RequestApprovalDetailAction.requestAssignDetail
      1. com.thortech.xl.webclient.actions.RequestApprovalDetailAction.setApproveDeny(Unknown Source)
      2. com.thortech.xl.webclient.actions.RequestApprovalDetailAction.requestAssignDetail(Unknown Source)
      2 frames
    19. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1081.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    20. struts
      DispatchAction.dispatchMethod
      1. org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
      1 frame
    21. com.thortech.xl
      tcAction.execute
      1. com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
      2. com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
      3. com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
      3 frames
    22. struts
      ActionServlet.doPost
      1. org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
      2. org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
      3. org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      4. org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
      4 frames
    23. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      2 frames
    24. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      2 frames
    25. com.thortech.xl
      SecurityFilter.doFilter
      1. com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
      1 frame
    26. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      2 frames
    27. JBoss Application Server Tomcat
      ReplyHeaderFilter.doFilter
      1. org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      1 frame
    28. Glassfish Core
      StandardContextValve.invoke
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      4 frames
    29. JBoss Application Server Tomcat
      JaccContextValve.invoke
      1. org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      2. org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      2 frames
    30. Glassfish Core
      ErrorReportValve.invoke
      1. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      2. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      2 frames
    31. JBoss Application Server Tomcat
      CachedConnectionValve.invoke
      1. org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      1 frame
    32. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      2. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      2 frames
    33. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      3 frames
    34. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:619)
      1 frame