3 Replies Latest reply on Feb 7, 2003 6:47 AM by Stephen Coy

    Problem storing Serializable object into MS Access2000

    Leslie Liew Eng Chuan Newbie

      i have two problems with jbosscmp-jdbc.xml.

      FIRST

      I'm using Jboss3.04 and it seems that i couldn't store serializable object into Ms Access database colume when i deploy the entity bean into JBoss.

      <?xml version="1.0"?>
      <jbosscmp-jdbc>


      java:/jdbc/OrderDataSource
      <!--datasource-mapping>MS ACCESS2000</datasource-mapping-->
      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>


      <enterprise-beans>


      <ejb-name>OrderBean</ejb-name>
      <table-name>Order_Table</table-name>
      <datasource-mapping>MS ACCESS2000</datasource-mapping>
      <cmp-field>
      <field-name>orderID</field-name>w
      <column-name>orderID</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>customerName</field-name>
      <column-name>customerName</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(50)</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>shipAddress</field-name>
      <column-name>shipAddress</column-name>
      <jdbc-type>JAVA_OBJECT</jdbc-type>
      <sql-type>OLEOBJECT</sql-type>
      </cmp-field>


      </enterprise-beans>

      </jbosscmp-jdbc>



      <?xml version="1.0"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <ejb-name>OrderBean</ejb-name>
      value_objects.OrderHome
      value_objects.Order
      <ejb-class>value_objects.OrderBean</ejb-class>
      <prim-key-class>java.lang.Integer</prim-key-class>
      <persistence-type>Container</persistence-type>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Order</abstract-schema-name>
      <cmp-field><field-name>orderID</field-name></cmp-field>
      <cmp-field><field-name>customerName</field-name></cmp-field>
      <cmp-field><field-name>shipAddress</field-name></cmp-field>
      <primkey-field>orderID</primkey-field>
      <resource-ref>
      <!-- resource reference name here must match with the resource name in jboss.xml -->
      <res-ref-name>jdbc/OrderDataSource</res-ref-name>
      <res-type>java.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      <assembly-descriptor>
      <security-role>
      <role-name>Manager</role-name>
      </security-role>
      <container-transaction>

      <ejb-name>OrderBean</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      When i deployed the entity bean, it's deployed successful. But when i run the client, it gave this exception where i found out it only gave exception when it reached the line of storing the SERIALIZABLE object..it has this exception..

      javax.ejb.EJBException: Internal error setting parameters for field shipAddress
      CausedByException is:
      SQL Exception : Unknown SQL Type for PreparedStatement.setObject (SQL T
      pe=2000
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.set
      rgumentParameters(JDBCAbstractCMPFieldBridge.java:297)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.set
      nstanceParameters(JDBCAbstractCMPFieldBridge.java:270)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(
      DBCCreateEntityCommand.java:192)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCC
      eateEntityCommand.java:131)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCSto
      eManager.java:527)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersiste
      ceManager.java:253)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.cre
      teEntity(CachedConnectionInterceptor.java:270)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:731)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(Entity
      ontainer.java:1119)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterce
      tor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(En
      itySynchronizationInterceptor.java:206)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.inv
      keHome(CachedConnectionInterceptor.java:215)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterce
      tor.java:73)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityIns
      anceInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInt
      rceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCre
      tionInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInt
      rceptor.java:111)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterce
      torCMT.java:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.j
      va:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterce
      tor.java:105)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:
      29)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.Container.invoke(Container.java:730)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java
      382)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:
      60)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTranspor
      .java:701)
      at java.lang.Thread.run(Thread.java:536)
      java.sql.SQLException: SQL Exception : Unknown SQL Type for PreparedStatement.s
      tObject (SQL Type=2000
      at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedSt
      tement.java:1415)
      at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedSt
      tement.java:1072)
      at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.setObje
      t(LocalPreparedStatement.java:607)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.setParameter(JDBCUtil.java:2
      0)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.set
      rgumentParameters(JDBCAbstractCMPFieldBridge.java:291)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.set
      nstanceParameters(JDBCAbstractCMPFieldBridge.java:270)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(
      DBCCreateEntityCommand.java:192)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCC
      eateEntityCommand.java:131)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCSto
      eManager.java:527)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersiste
      ceManager.java:253)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.cre
      teEntity(CachedConnectionInterceptor.java:270)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:731)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(Entity
      ontainer.java:1119)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterce
      tor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(En
      itySynchronizationInterceptor.java:206)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.inv
      keHome(CachedConnectionInterceptor.java:215)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterce
      tor.java:73)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityIns
      anceInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInt
      rceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCre
      tionInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInt
      rceptor.java:111)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterce
      torCMT.java:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.j
      va:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterce
      tor.java:105)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:
      29)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.Container.invoke(Container.java:730)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java
      382)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:
      60)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTranspor
      .java:701)
      at java.lang.Thread.run(Thread.java:536)


      ----------------------------------------------------------


      My Second Problem is

      if UN-comment the datasource-mapping tag in the jbosscmp-jdbc.xml and deploy the entity into jboss, it ll give this exception...

      11:39:05,226 INFO [MainDeployer] Starting deployment of package: file:/C:/JBoss
      /server/default/deploy/CmpOrderBean.jar
      11:39:05,286 INFO [EjbModule] Creating
      11:39:05,296 INFO [EjbModule] Deploying OrderBean
      11:39:05,316 INFO [EjbModule] Created
      11:39:05,316 INFO [EjbModule] Starting
      11:39:05,396 WARN [ServiceController] Problem starting service jboss.j2ee:jndiN
      ame=OrderBean,service=EJB
      org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc.xml : datasourc
      e-mapping MS ACCESS2000 not found
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.(JDB
      CEntityMetaData.java:374)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:237)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXm
      lFileLoader.java:75)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaDat
      a(JDBCStoreManager.java:677)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBC
      StoreManager.java:389)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
      r.java:339)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
      er.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
      at org.jboss.ejb.Container.invoke(Container.java:756)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:978)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:398)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy65.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
      65)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:978)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:398)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy9.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:395)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
      at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:435)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDe
      ploymentScanner.java:656)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:507)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      doScan(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      loop(AbstractDeploymentScanner.java:225)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      run(AbstractDeploymentScanner.java:202)
      11:39:05,406 INFO [EjbModule] Started
      11:39:05,406 INFO [MainDeployer] Deployed package: file:/C:/JBoss/server/defaul
      t/deploy/CmpOrderBean.jar
      11:39:05,406 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean ope
      ration 'checkIncompleteDeployments()'
      Cause: Incomplete Deployment listing:
      Packages waiting for a deployer:

      Incompletely deployed packages:

      MBeans waiting for classes:

      MBeans waiting for other MBeans:
      [ObjectName: jboss.j2ee:jndiName=OrderBean,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc
      .xml : datasource-mapping MS ACCESS2000 not found]



      --------------------------------------------------------


      please enlighten me ...please enlighten me.... please help...