12 Replies Latest reply on Jul 2, 2002 5:51 PM by Dain Sundstrom

    TRANSACTION ROLLBACK EXCEPTION:Load failed;

    Swaminathan Newbie

      Hi I am getting the Load Failed exception
      when trying to look up a entity bean thru a session
      bean. The query criteria matches a row which is present
      in the database. The same works for a different
      criteria and doesn't work for some.
      What could be the problem??
      Here's the server log.

      thanks


      [Entity1] Activated bean Entity1 with id = Column 1 - 420 Column 2 - 2001-10-26 Column 3 - XXX Column 4 - XXX Column 5 - XXX
      [Entity1] TRANSACTION ROLLBACK EXCEPTION:Load failed; nested exception is:
      java.lang.NullPointerException; nested exception is:
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.NullPointerException
      [Entity1] java.rmi.ServerException: Load failed; nested exception is:
      [Entity1] java.lang.NullPointerException
      [Entity1] java.lang.NullPointerException
      [Entity1] at java.lang.reflect.Field.set(Native Method)
      [Entity1] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setCMPFieldValue(JDBCCommand.java:655)
      [Entity1] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneEntity(JDBCLoadEntityCommand.java:217)
      [Entity1] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleResult(JDBCLoadEntityCommand.java:176)
      [Entity1] at org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult(JDBCQueryCommand.java:59)
      [Entity1] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:160)
      [Entity1] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:147)
      [Entity1] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistenceManager.java:156)
      [Entity1] at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:362)
      [Entity1] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:286)
      [Entity1] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:208)
      [Entity1] at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:136)
      [Entity1] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
      [Entity1] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [Entity1] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
      [Entity1] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      [Entity1] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      [Entity1] at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:427)
      [Entity1] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:483)
      [Entity1] at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:335)
      [Entity1] at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:133)
      [Entity1] at $Proxy25.getCount(Unknown Source)
      [Entity1] at java.lang.reflect.Method.invoke(Native Method)
      [Entity1] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:543)
      [Entity1] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:87)
      [Entity1] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
      [Entity1] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [Entity1] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
      [Entity1] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      [Entity1] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      [Entity1] at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:286)
      [Entity1] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:393)
      [Entity1] at java.lang.reflect.Method.invoke(Native Method)
      [Entity1] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      [Entity1] at sun.rmi.transport.Transport$1.run(Transport.java:142)
      [Entity1] at java.security.AccessController.doPrivileged(Native Method)
      [Entity1] at sun.rmi.transport.Transport.serviceCall(Transport.java:139)
      [Entity1] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)
      [Entity1] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:643)
      [Entity1] at java.lang.Thread.run(Thread.java:484)
      [Default] javax.transaction.TransactionRolledbackException: Load failed; nested exception is:
      java.lang.NullPointerException; nested exception is:
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.NullPointerException
      [Default] java.rmi.ServerException: Load failed; nested exception is:
      java.lang.NullPointerException
      [Default] java.lang.NullPointerException
      [Default] at java.lang.reflect.Field.set(Native Method)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setCMPFieldValue(JDBCCommand.java:655)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneEntity(JDBCLoadEntityCommand.java:217)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleResult(JDBCLoadEntityCommand.java:176)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult(JDBCQueryCommand.java:59)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:160)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:147)
      [Default]
      [Default] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistenceManager.java:156)
      [Default]
      [Default] at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:362)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:286)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:208)
      [Default]
      [Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:136)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
      [Default]
      [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      [Default]
      [Default] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      [Default]
      [Default] at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:427)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:483)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:335)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:133)
      [Default]
      [Default] at $Proxy25.getAiFcFCpns(Unknown Source)
      [Default]
      [Default] at xxx.xxx.xxx.MySessionBean.java:1142)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:543)
      [Default]
      [Default] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:87)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [Default]
      [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
      [Default]
      [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      [Default]
      [Default] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      [Default]
      [Default] at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:286)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:393)
      [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:142)
      [Default]
      [Default] at java.security.AccessController.doPrivileged(Native Method)
      [Default]
      [Default] at sun.rmi.transport.Transport.serviceCall(Transport.java:139)
      [Default]
      [Default] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)
      [Default]
      [Default] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:643)
      [Default]
      [Default] at java.lang.Thread.run(Thread.java:484)
      [Default]
      [FlightControllerBean] TRANSACTION ROLLBACK EXCEPTION:Load failed; nested exception is:
      java.lang.NullPointerException; nested exception is:
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.NullPointerException; nested exception is:
      javax.transaction.TransactionRolledbackException: Load failed; nested exception is:
      java.lang.NullPointerException; nested exception is:
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.NullPointerException

        • 1. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
          David Jencks Master

          I think you can get NPE's like this if you have primitive types as your entity fields and null values in the db columns. If you have nulls in your db, you have to use object wrappers (Integer instead of int, etc)

          • 2. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
            Rajesh Newbie

            hi

            I am facing the same problem. If u find any solution, please forward it to me.

            thanx
            rajesh

            • 3. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
              Roland Chan Newbie

              This question comes up repeatedly in numerous mailing lists, this forum, and everywhere else. I too am having the same issue.

              Environment:

              SQL Server 2000
              JDK 1.3.1
              JBoss 2.4.3/Tomcat3.2.2

              At any rate it would be nice to have a definitive answer on this. My fields are not primitive types, are not null, and are Integers (or any other object I try for that matter). Please advise.

              • 4. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                Ben Alex Newbie

                Hi

                Whilst I do not have the same problem as you, I did have a problem that reported transaction rollback exceptions. I based my session bean on the CDCollectionBean included in the documentation-example archive. I'll include my solution below, because perhaps others have also based their beans on CMP-CD.

                If you use the CMP-CD example, but change Upload.java to comment cdCollection.deleteAll() on line 74, you will receive a transaction rollback exception when you execute the ant cmp-cd-upload task on the second occasion. The exception relates to a duplicate key.

                You need to modify CDCollectionBean.java's addCd() method so it correctly throws the exception back to the caller. The code as it is in the example goes to the trouble of generating a CDExistsException, but then it catches it and tries to do the insert anyway. This causes the transaction exception. The correct code for addCd() is:

                try
                {
                CD oldCd = home.findByPrimaryKey(id);
                Integer dummy = oldCd.getId(); // Force loading of data here
                // If we get here, the CD is already in the collection
                throw new CDExistsException();
                }
                catch (CDExistsException cde)
                {
                throw new CDExistsException();
                }
                catch (Exception e)
                {
                // as per current code....

                In fairness, the author of CDCollectionBean did say in their comments the bean isn't for air traffic control. But given I used it anyway, perhaps others did also. BTW, my thanks to the people who are behind JBoss for such a great product.

                Hope this helps someone out there.

                Ben

                • 5. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                  Ron Newbie

                  Hi I am also having the exact problem that Swaminathan has
                  written in his mail.

                  For me the exception seems to happen when more than one thread try to read the same entity at the same time.

                  If any one of you has found a solution to the problem can u please mail it to the forum.

                  Thanks,
                  Randy

                  • 6. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                    Erik Sliman Apprentice

                    Add me to the list of TRE victims. Anyone have a solution?

                    • 7. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                      Erik Sliman Apprentice

                      Hopefully describing how I diagnosed the problem will help others.

                      When I switched from a local to remote interface, the TRE went away. I then discovered that I was missing the and <local-home> tags in the EJB-JAR for the bean. When I added them, I was able to use the local interface without a TRE.

                      This is one case where the obvious isn't so obvious, because the error doesn't appear to be even remotely (no pun intended) related. Also, the real problem is one where a common step was missed (EJB-JAR configuration), and there was no error to report it.

                      In four years it will be impossible to make a simple error. Ooops, forgot, Java solved this years ago.

                      • 8. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                        Oytan022 Newbie

                        when u have such problem, please check the following points:

                        1. null value in database which match a primitive field in ur CMP beans as some replies anwsered.

                        2. imcompatable data type between bean class field and database field, especially check int, long, short, byte fields. I had the same problem caused by int type for Oracle Number type. I found the Number type I defined in db is larger than max int.

                        "Load failed" means when u call any business method, container loading data from db to ur bean failed

                        Hope it is helpful.

                        • 9. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                          Jason Gerard Newbie

                          I am having a similar problem. I have the same environment except I'm using JBoss 2.4.4/Tomcat4.0.1. My fields are not primitive, not null. I was wondering if you or anyone else has found a solution but not posted it.

                          • 10. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                            Bani Greyling Newbie

                            I have similar problem
                            javax.transaction.TransactionRolledbackException: Load failed; nested exception is:
                            java.lang.IllegalArgumentException: object is not an instance of declaring class; nested exception is:
                            java.rmi.ServerException: Load failed; nested exception is:
                            java.lang.IllegalArgumentException: object is not an instance of declaring class
                            java.rmi.ServerException: Load failed; nested exception is:
                            java.lang.IllegalArgumentException: object is not an instance of declaring class
                            java.lang.IllegalArgumentException: object is not an instance of declaring class
                            at java.lang.reflect.Field.get(Native Method)

                            I stepped through JBoss code and found that this exception occured when the primary key is loaded by the different classloader than the bean . This puzzled me and I do not know of a solution. I am currently on JBoss2.4.7

                            Regards
                            Bani Greyling

                            • 11. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                              Bani Greyling Newbie

                              I have similar problem
                              javax.transaction.TransactionRolledbackException: Load failed; nested exception is:
                              java.lang.IllegalArgumentException: object is not an instance of declaring class; nested exception is:
                              java.rmi.ServerException: Load failed; nested exception is:
                              java.lang.IllegalArgumentException: object is not an instance of declaring class
                              java.rmi.ServerException: Load failed; nested exception is:
                              java.lang.IllegalArgumentException: object is not an instance of declaring class
                              java.lang.IllegalArgumentException: object is not an instance of declaring class
                              at java.lang.reflect.Field.get(Native Method)

                              I stepped through JBoss code and found that this exception occured when the primary key is loaded by the different classloader than the bean . This puzzled me and I do not know of a solution. I am currently on JBoss2.4.7

                              Regards
                              Bani Greyling

                              • 12. Re:  TRANSACTION ROLLBACK EXCEPTION:Load failed;
                                Dain Sundstrom Master

                                Classes loaded by different class loaders are not the same class and you will get a class cast exception. The type of problem is why we intoduced the UnifiedClassLoader in JBoss 3.0. With the UniifiedClassLoader there is a centeral repository of classes. This won't help you in 2.4. If I remember correctly, the key to 2.4 is to assure that there is only a in the server jar which has a copy of a class.