1 Reply Latest reply on Nov 29, 2002 11:39 AM by ian

    jbosscmp-jdbc.xml mappings

    ian Newbie

      Hello all,

      I wonder if someone could explain the following
      I am using jboss-3.0.0_tomcat-4.0.3 with MySQL

      I have a session bean and an entity bean ( band) which has the following attributes
      String bandName
      String founder
      SQLDate startDate

      SQLDate extends java.sql.Date and is essentially a wrapper around a java.util.Date

      There are 2 methods on the session bean - one to add a band, and one to remove a band.

      I have set up jbosscmp-jdb.xml to map the SQLDate as follows ( ie like a java.sql.Date)


      <java-type>examples.ejb20.bands.SQLDate</java-type>
      <jdbc-type>DATE</jdbc-type>
      <sql-type>DATETIME</sql-type>


      When the addBand the band is added as expected, but when removeBand is called I get the following from the server.log

      2002-11-29 16:36:03,321 INFO [org.jboss.web.localhost.Engine] action: Processing a POST for /removeBand416
      2002-11-29 16:36:03,321 INFO [org.jboss.web.localhost.Engine] action: Looking for ActionForm bean under attribute 'removeBandForm416'
      2002-11-29 16:36:03,321 INFO [org.jboss.web.localhost.Engine] action: Creating new ActionForm instance of class 'examples.ejb20.bands.web.removeBandForm416'
      2002-11-29 16:36:03,321 INFO [org.jboss.web.localhost.Engine] action: Storing instance under attribute 'removeBandForm416' in scope 'request'
      2002-11-29 16:36:03,321 INFO [org.jboss.web.localhost.Engine] action: Populating bean properties from this request
      2002-11-29 16:36:03,602 INFO [org.jboss.web.localhost.Engine] action: Validating input form properties
      2002-11-29 16:36:03,602 INFO [org.jboss.web.localhost.Engine] action: No errors detected, accepting input
      2002-11-29 16:36:03,602 INFO [org.jboss.web.localhost.Engine] action: Looking for Action instance for class examples.ejb20.bands.web.removeBandAction416
      2002-11-29 16:36:03,602 INFO [org.jboss.web.localhost.Engine] action: Double checking for Action instance already there
      2002-11-29 16:36:03,602 INFO [org.jboss.web.localhost.Engine] action: Creating new Action instance
      2002-11-29 16:36:03,696 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.BandEJB] Executing SQL: SELECT startDate FROM Bands WHERE (name=? AND founder=?)
      2002-11-29 16:36:03,696 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:
      java.sql.SQLException: Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.getResult(JDBCUtil.java:219)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadArgumentResults(JDBCAbstractCMPFieldBridge.java:350)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadInstanceResults(JDBCAbstractCMPFieldBridge.java:304)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:142)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:495)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:410)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(CachedConnectionInterceptor.java:353)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:310)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:193)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:296)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:105)
      at $Proxy70.remove(Unknown Source)
      at examples.ejb20.bands.MusicLibraryBeanImpl.removeBandPKImpl(MusicLibraryBeanImpl.java:51)
      at examples.ejb20.bands.MusicLibraryBeanBase.removeBandPK(MusicLibraryBeanBase.java:54)
      at examples.ejb20.bands.MusicLibraryBeanImpl.removeBandImpl(MusicLibraryBeanImpl.java:60)
      at examples.ejb20.bands.MusicLibraryBeanBase.removeBand(MusicLibraryBeanBase.java:69)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:705)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy68.removeBand(Unknown Source)
      at examples.ejb20.bands.MusicLibraryDelegate.removeBand(MusicLibraryDelegate.java:104)
      at examples.ejb20.bands.web.removeBandAction416.perform(removeBandAction416.java:57)
      at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
      at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
      at java.lang.Thread.run(Thread.java:484)
      2002-11-29 16:36:03,696 INFO [STDOUT] class examples.ejb20.bands.MusicLibraryDelegate$UnexpectedException exception in removeBandAction416, message=Unexpected Exception: Error calling removeBand( BandInfo bandInfo ), of type java.rmi.ServerException Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'; nested exception is:
      javax.ejb.EJBException: Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'
      Embedded Exception
      Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'; nested exception is:
      javax.ejb.EJBException: Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'; nested exception is:
      javax.ejb.TransactionRolledbackLocalException: Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'; nested exception is:
      javax.ejb.EJBException: Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'
      Embedded Exception
      Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'; nested exception is:
      javax.ejb.EJBException: Internal error getting results for field member startDate
      Embedded Exception
      Unable to load a ResultSet column into a variable of type 'examples.ejb20.bands.SQLDate'
      2002-11-29 16:36:03,711 INFO [STDOUT] examples.ejb20.bands.removeBandAction416.perform(), mapping.getInput()=/removeBand416.jsp


      It is worth noting than when I change startDate to a java.util.Date everything works.
      Also if startDate is set as a SQLDate but there is no mapping in the jbosscmp-jdbc.xml for a SQLDate everthing works but the startDate in the database is a meaningless character.
      I think it is safe to conclude the SQLDate mapping is the problem but could any explain what is wrong

      regards

      Ian