2 Replies Latest reply on Mar 30, 2006 9:51 AM by Hugo

    JBoss and MySql auto increment deployment errors

    tini verdnik Newbie

      Hi, I have the following jbosscmp-jdbc.xml (created by jbuilder):

      <jbosscmp-jdbc>
       <defaults>
       <datasource>java:/Projekt</datasource>
       <datasource-mapping>mySQL</datasource-mapping>
       <unknown-pk>
       <unknown-pk-class>java.lang.Integer</unknown-pk-class>
       <field-name>id</field-name>
       <column-name>id</column-name>
       <jdbc-type>INTEGER</jdbc-type>
       <sql-type>int(11)</sql-type>
       <auto-increment />
       </unknown-pk>
       <entity-command name="mysql-get-generated-keys" />
       </defaults>
       <enterprise-beans>
       <entity>
       <ejb-name>Person</ejb-name>
       ......
      </jbosscmp-jdbc>


      MySql is set up to auto increment id field in the table. But when I try to deploy the package, JBoss comes out with the following errors:

      11:30:49,493 INFO [EntityContainer] Started jboss.j2ee:jndiName=Person,service=EJB
      11:30:49,503 ERROR [EntityContainer] Starting failed
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge$CMRJDBCType.(JDBCCMRFieldBridge.java:1841)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge$CMRJDBCType.(JDBCCMRFieldBridge.java:1822)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.initializeForeignKeyFields(JDBCCMRFieldBridge.java:1596)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.resolveRelationship(JDBCCMRFieldBridge.java:297)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.resolveRelationships(JDBCEntityBridge.java:286)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.resolveRelationships(JDBCStoreManager.java:445)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:379)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy53.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy12.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)


      I wonder if anyone had similar problems. I would understand errors when creating/finding entities, but the null ptr exception comes out at deployment!

      When I remove the unknown key/auto increment alltogether it works fine.

        • 1. Re: JBoss and MySql auto increment deployment errors
          Russ Loucks Newbie

          I don't know how/what JBuilder does its magic, I use Xdoclet.... Here's what Xdoclet generates for me for a CMP bean with 'auto-increment' for a primary key.

          In jbosscmp-jdbc.xml (for bean BaseType with primary key baseTypeKey):

           <entity>
           <ejb-name>BaseType</ejb-name>
           <cmp-field>
           <field-name>baseTypeKey</field-name>
           <column-name>baseTypeKey</column-name>
           <auto-increment/>
           </cmp-field>
           .
           .
           <unknown-pk>
           <unknown-pk-class>java.lang.Integer</unknown-pk-class>
           <column-name>baseTypeKey</column-name>
           <jdbc-type>INTEGER</jdbc-type>
           <sql-type>INTEGER</sql-type>
           <auto-increment/>
           </unknown-pk>
           <entity-command name="mysql-get-generated-keys" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand">
           </entity-command>
           </entity>
          

          Hope that helps....

          • 2. Re: JBoss and MySql auto increment deployment errors
            Hugo Newbie

            Hi redbeard15, It certainly helped me, thanks!