4 Replies Latest reply on Apr 8, 2002 12:41 PM by rinehart

    BMP transaction prob in Jboss 3.0.0beta2

    rinehart

      I'm having a problem with transactions and BMP entity beans. I just got the build today, and ran clean before rebuilding.

      In my source I invoke a find, which works. I think try to get fields of the entity bean through the remote interface. With trace turned on, I can see that the finder is invoked, then the ejbLoad is invoked when I get the first field. After that my client program receives a Server Exception: RemoteException occured in server thread; Nested exception is java.lang.IllegalStateException: Removing bean lock and it has TX Set!

      Unfortunately I don't have the server stack trace, as the server does not display a stack trace for this exception, even with the DEBUG threshold set. For what it's worth, I've attached the client code that generates the exception. The error line is marked with a *.

      public void testBeanManagedPersistence() {
      &nbsp&nbsp System.out.println();
      &nbsp&nbsp System.out.println("This tester verifies that BMP is working properly.");
      &nbsp&nbsp System.out.println("Creating Harriet Hightower.");
      &nbsp&nbsp AccountHolderBMPRemote harriet = null;
      &nbsp&nbsp&nbsp&nbsp try{
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Object obj = ctx.lookup("atm/bmp/ejb/accountHolderEJB");
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp AccountHolderBMPRemoteHome bmpHome = (AccountHolderBMPRemoteHome)
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp PortableRemoteObject.narrow(obj, AccountHolderBMPRemoteHome.class);
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp try{
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp harriet = bmpHome.findByIdentity("hhightower", "123");
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp System.out.println("Harriet Hightower is found.");
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp }
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp catch(FinderException e){
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp harriet = bmpHome.create("Harriet", "Hightower", "your.name@your.domain", "hhightower", "123");
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp System.out.println("Harriet Hightower is created.");
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp }
      *&nbsp&nbsp&nbsp&nbsp&nbsp System.out.println( harriet.getFirstName() + " " + harriet.getLastName() + " " + harriet.getEmailAddress());
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp System.out.println("Harriet's Primary key is " + harriet.getPrimaryKey().toString());
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp harriet.remove();
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp System.out.println("Harriet has been removed.");
      &nbsp&nbsp&nbsp&nbsp }
      &nbsp&nbsp&nbsp&nbsp catch(Exception e){
      &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp e.printStackTrace();
      &nbsp&nbsp&nbsp&nbsp }
      }

      This code blows when attempting to invoke harriet.getFirstName(). I can't see that there's a problem with this source. Hopefully someone can offer some insight into what might cause that transaction problem. Thanks,

      Mac

        • 1. Re: BMP transaction prob in Jboss 3.0.0beta2
          davidjencks

          The sequence of calls looks very similar to the sequence in the cts/BMPUnitTestCase/tesEjbCreate in the testsuite, which passes for me. Would you consider sending me your bean + junit test to look at and possibly add to the test suite? Could you also check that the test I mentioned passes for you as well?

          Thanks
          david jencks

          • 2. Re: BMP transaction prob in Jboss 3.0.0beta2
            rinehart

            I'll do that here. In the mean time, I've been snooping around. That error message I get is comming from the org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef() method. I did a search for uses on that method, that class, and subclasses, and I can't find any anywhere. I know it must be invoked somewhere, otherwise, how could that exception method be generated?

            Frustrating...

            Ok, I'll run that test and get back to you.

            • 3. Re: BMP transaction prob in Jboss 3.0.0beta2
              rinehart

              Ok - I've got your testcase run. I got ten tests passed and one failure. The one that didn't work was testProbeContainerCallbacks. The stacktrace follows:

              Expected to receive notification of EJB_CREATE_MSG

              junit.framework.AssertionFailedError: Expected to receive notification of EJB_CREATE_MSG
              at junit.framework.Assert.fail(Assert.java:51)
              at junit.framework.Assert.assertTrue(Assert.java:38)
              at org.jboss.test.cts.test.BmpUnitTestCase.testProbeContainerCallbacks(BmpUnitTestCase.java:549)
              at java.lang.reflect.Method.invoke(Native Method)
              at junit.framework.TestCase.runTest(TestCase.java:166)
              at junit.framework.TestCase.runBare(TestCase.java:140)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:131)
              at junit.framework.TestSuite.runTest(TestSuite.java:173)
              at junit.framework.TestSuite.run(TestSuite.java:168)
              at junit.framework.TestSuite.runTest(TestSuite.java:173)
              at junit.framework.TestSuite.run(TestSuite.java:168)
              at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
              at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.extensions.TestSetup.run(TestSetup.java:23)
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:231)
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:409)

              • 4. Re: BMP transaction prob in Jboss 3.0.0beta2
                rinehart

                FYI - I did a clean checkout and rebuild, and now everything in the BmpUnitTestCase passes.