0 Replies Latest reply on Dec 28, 2001 5:11 PM by glm

    Problems using AutoNumberFactory.getNextInteger()

    glm Newbie

      Hi;
      I am trying to use AutoNumberFactory.getNextInteger("nameofbean") in my CMP Entity bean to autogenerate a primary key. I get the following error message when executing the getNextInteger() method:

      [Default] javax.ejb.CreateException: Could not create entity:java.sql.SQLException: Unable to create PreparedStatement!
      [Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:139)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createEntity(JAWSPersistenceManager.java:128)
      [Default]
      [Default] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:231)
      [Default]
      [Default] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:616)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:843)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:231)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:154)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:108)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      [Default]
      [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:103)
      [Default]
      [Default] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
      [Default]
      [Default] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:441)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:237)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
      [Default]
      [Default] at $Proxy8.create(Unknown Source)
      [Default]
      [Default] at org.jboss.util.AutoNumberFactory.getNextInteger(AutoNumberFactory.java:48)
      [Default]
      [Default] at com.paye.payroll.ClientBean.ejbCreate(ClientBean.java:100)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:204)
      [Default]
      [Default] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:616)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:843)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:231)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:154)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:108)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      [Default]
      [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:103)
      [Default]
      [Default] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
      [Default]
      [Default] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:372)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      [Default]
      [Default] at sun.rmi.transport.Transport$1.run(Transport.java:152)
      [Default]
      [Default] at java.security.AccessController.doPrivileged(Native Method)
      [Default]
      [Default] at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      [Default]
      [Default] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      [Default]
      [Default] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      [Default]
      [Default] at java.lang.Thread.run(Thread.java:484)
      [Default]
      [Default] null
      [Client] TRANSACTION ROLLBACK EXCEPTION:null
      Embedded Exception
      null; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      null
      [Client] java.lang.NullPointerException
      [Client] at com.paye.payroll.ClientBean.ejbCreate(ClientBean.java:108)
      [Client] at java.lang.reflect.Method.invoke(Native Method)
      [Client] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:204)
      [Client] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:616)
      [Client] at java.lang.reflect.Method.invoke(Native Method)
      [Client] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:843)
      [Client] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:231)
      [Client] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:154)
      [Client] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:108)
      [Client] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
      [Client] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [Client] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      [Client] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:103)
      [Client] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
      [Client] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)
      [Client] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:372)
      [Client] at java.lang.reflect.Method.invoke(Native Method)
      [Client] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      [Client] at sun.rmi.transport.Transport$1.run(Transport.java:152)
      [Client] at java.security.AccessController.doPrivileged(Native Method)
      [Client] at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      [Client] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      [Client] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      [Client] at java.lang.Thread.run(Thread.java:484)

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

      It appears that getNextInteger() calls autoNumberHome.create(collectionName); and it is the create method that is failing. From looking at the source code I don't see why it should fail. Can someone point me in the right direction?

      Thanks,

      Gary