Entity Creation Problem
-----------------------

         Key: JBAS-167
         URL: http://jira.jboss.com/jira/browse/JBAS-167
     Project: JBoss Application Server
        Type: Patch
    Reporter: SourceForge User
 Assigned to: Bill Burke 



SourceForge Submitter: objectwiz .
When I used the CVS tree build of JBoss "as is" I got
the following error when I created Entity Beans:

java.lang.IllegalStateException: do not call
nextTransaction while not synched!
        at
org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.nextTransaction(QueuedPessimisticEJBLock.java:400)
        at
org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.endTransaction(QueuedPessimisticEJBLock.java:430)
        at
org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.endInvocation(QueuedPessimisticEJBLock.java:454)
        at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:246)
        at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:176)
        at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:134)
        at
org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
        at
org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
        at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:273)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
        at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
        at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
        at
org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
        at
org.jboss.ejb.Container.invoke(Container.java:727)
        at
org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
        at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492)
        at
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364)
        at java.lang.reflect.Method.invoke(Native Method)
        at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
        at
sun.rmi.transport.Transport$1.run(Transport.java:152)
        at
java.security.AccessController.doPrivileged(Native Method)
        at
sun.rmi.transport.Transport.serviceCall(Transport.java:148)
        at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
        at java.lang.Thread.run(Thread.java:484)

So I wrote a patch for it and it seems to work. There
may be many good reasons why this isn't a good idea,
but here it is anyway in unified diff. I left my
System.outs in as it will allow the person viewing the
patch to see the behaviour:

Index:
server/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java,v
retrieving revision 1.9
diff -u -r1.9 QueuedPessimisticEJBLock.java
---
server/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java
   10 Apr 2002 05:44:03 -0000      1.9
+++
server/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java
   24 Apr 2002 08:12:19 -0000
@@ -427,7 +427,43 @@

    public void endTransaction(Transaction transaction)
    {
-      nextTransaction();
+      System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] START >>>" );
+
+      boolean releaseSync = false;
+
+      try
+      {
+        if( !synched )
+        {
+          this.sync();
+          releaseSync = true;
+
+          System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] called
sync()" );
+        }
+        else
+        {
+          System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] already
synched" );
+        }
+
+        System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] \tnext
trans >>>" );
+        nextTransaction();
+        System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] \tnext
trans <<<" );
+      }
+      finally
+      {
+        if( releaseSync )
+        {
+          this.releaseSync();
+
+          System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] called
releaseSync()" );
+        }
+        else
+        {
+          System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] no synch
to release" );
+        }
+
+        System.out.println(
"[QueuedPessimisticEJBLock.endTransaction()] END  <<<" );
+      }
    }

    public void wontSynchronize(Transaction trasaction)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to