3 Replies Latest reply on Mar 11, 2002 9:10 AM by rilux

    Primary key exception

    rilux

      Hi,

      I'm an ultra-newbie to EJB/JBOSS so forgive me if this is a silly question.

      I'm learning EJB from the O'Reilly book Enterprise JavaBeans (3rd edition) and have developed my own EJB rather than copy straight from the book.

      The EJB will eventually use a database but I have none set up at the moment. The CMP example I'm working from also does not use a database datasource yet includes all the other necessary gumph with fields and primary keys, etc.

      Anyway, I am getting an exception when running my test client. The server cannot create a primary key. Any idea why this is?

      rilux

        • 1. Re: Primary key exception
          rilux

          Sorry, the whole exception is:

          java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
          javax.transaction.TransactionRolledbackException: Could not create primary key; nested exception is:
          java.lang.InstantiationException: java.lang.Integer; nested exception is:
          java.rmi.ServerException: Could not create primary key; nested exception is:
          java.lang.InstantiationException: java.lang.Integer
          javax.transaction.TransactionRolledbackException: Could not create primary key; nested exception is:
          java.lang.InstantiationException: java.lang.Integer; nested exception is:
          java.rmi.ServerException: Could not create primary key; nested exception is:
          java.lang.InstantiationException: java.lang.Integer
          java.rmi.ServerException: Could not create primary key; nested exception is:
          java.lang.InstantiationException: java.lang.Integer
          java.lang.InstantiationException: java.lang.Integer
          at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
          at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
          at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
          at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHome(Unknown Source)
          at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:258)
          at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
          at $Proxy0.create(Unknown Source)

          I am specifying the primary key when I create the object.

          Rilux

          • 2. Re: Primary key exception
            dsundstrom

            Look in the server.log file in the log directory. It should have a much more detailed exception.

            Are you using a custom primary key? If so, is it specified correctly in the ejb-jar.xml file?

            Are you using an unknown primary-key? If so, this is not supported yet.

            • 3. Re: Primary key exception
              rilux

              There was an error in ejb-xml.

              D'Oh!