4 Replies Latest reply on Apr 30, 2002 11:43 PM by dsundstrom

    NullPointer exception with CMP EJB

    klaasvdploeg

      I'm trying to get a very simple entity bean to work on jboss 2.4.4.
      Deploying goes fine, but as soon as I call it's create method from the client, it fails with the following exception on JBoss (see below).
      It looks like a nullpointer exception in org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute but I'm not sure on that.
      Can anybody shine some light on this? Thanks!

      Klaas.

      [ERROR,CabinEJB] TRANSACTION ROLLBACK EXCEPTION:
      javax.transaction.TransactionRolledbackException: null
      Embedded Exception
      null; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      null
      javax.ejb.EJBException: null
      Embedded Exception
      null
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:870)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:234)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:147)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:97)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:142)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:103)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:421)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:387)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      at sun.rmi.transport.Transport$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:112)
      at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createEntity(JAWSPersistenceManager.java:128)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:231)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:632)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:859)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:234)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:147)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:97)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:142)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:103)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:421)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:387)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      at sun.rmi.transport.Transport$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

        • 1. Re: NullPointer exception with CMP EJB
          giles

          Hi there

          Was wondering if you had managed to solve youre null pointer exception. I've got exactly the same issue, with the same error.

          Any help would be great
          Giles

          • 2. Re: NullPointer exception with CMP EJB
            cisbrh

            Hi,
            have you checked that none of your cmp fields are of primitve data type (int, long, etc...). Primitve data type cannot be null, so cmp fields must be wrapper types (Integer, long, etc...).
            Hope it helps,
            Benjamin

            • 3. Re: NullPointer exception with CMP EJB
              giles

              Hi

              Thanks for your reply.

              Are you saying that none of the fields that i make cmp can be primatives ? This seems a bit odd.... surely in a most situations there are going to be be instances where i will need/want primatives as cmp fields.

              If my understanding of what you say is correct, where should i be doing the wrapping... in the ejbCreate ?

              • 4. Re: NullPointer exception with CMP EJB
                dsundstrom

                > Are you saying that none of the fields that i make
                > cmp can be primatives ?

                No, what he is saying is you can't load a null valued column into a primitive. When JBossCMP inserts primitive value it always inserts the java default (unless already set).