Hi Aaron,

After the latest changes I sometimes get exceptions on transaction
commit(), like this: 

java.lang.IllegalArgumentException
    at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:72)
    at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:418)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
    at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:326)
    at 
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:163)
    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:142)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:139)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:643)
    at java.lang.Thread.run(Thread.java:484)

And on the next commit():

TRANSACTION ROLLBACK EXCEPTION:Application Error: tried to enter Stateful bean with 
different transaction context; nested exception is:
    java.rmi.RemoteException: Application Error: tried to enter Stateful bean with 
different transaction context
java.rmi.RemoteException: Application Error: tried to enter Stateful bean with 
different transaction context                            Best regards,
    at 
org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:148)
                      Oleg
    at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
    at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:378)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)         
                                                 jBoss CVS Development wrote:
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)            
                                                 jCD>   User: mulder
    at 
org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:326)       
                                          jCD>   Date: 00/10/25 16:54:37
    at 
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:163)
    at java.lang.reflect.Method.invoke(Native Method)                                  
                                                 jCD>   Modified:    
src/main/org/jboss/minerva/factories
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)             
                                                 jCD>                         
XAConnectionFactory.java
    at sun.rmi.transport.Transport$1.run(Transport.java:142)                           
                                                 jCD>   Log:
    at java.security.AccessController.doPrivileged(Native Method)                      
                                                 jCD>   More compliant with JDBC 2 
Optional Package spec.
    at sun.rmi.transport.Transport.serviceCall(Transport.java:139)                     
                                                 jCD>    - Don't de-register a 
connection from transaction in case of error
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)        
                                                 jCD>    - Don't allow commit, 
rollback, or setAutoCommit(true) if registered
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:643) 
                                                 jCD>        with transaction
    at java.lang.Thread.run(Thread.java:484)

I traced the first exception until the line 129 of
XAConnectionFactory.java:
        transListener = new TransactionListener() {
            public void transactionFinished(XAConnectionImpl con) {
here:           con.removeConnectionEventListener(errorListener);
the IllegalArgumentException is thrown because errorListener is not
found in the list of listeners. 

Certainly, it is possible that something is wrong in Castor-jBoss
integration (all there exception appeared when I worked through
Castor).
Could you give me a tip, what might be done wrong, what error could
cause the exception.

Regards,
 Oleg

                                                                                       
                                                                                       
  jCD>   Also try to avoid a sporadic problem in load test where it tries to
jCD>     deregister a connection from the transaction but it has no record
jCD>     of a resource for the connection.  I think this is a threading issue
jCD>     where somehow the event is triggered again before the listener is
jCD>     removed, though that's only a guess.  Unfortunately I've only seen
jCD>     the problem twice in about 50 5-minute runs, so it's pretty hard
jCD>     to test for.
  
jCD>   Revision  Changes    Path
jCD>   1.11      +8 -4      
jboss/src/main/org/jboss/minerva/factories/XAConnectionFactory.java
  
jCD>   Index: XAConnectionFactory.java
jCD>   ===================================================================
jCD>   RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/factories/XAConnectionFactory.java,v
jCD>   retrieving revision 1.10
jCD>   retrieving revision 1.11
jCD>   diff -u -r1.10 -r1.11
jCD>   --- XAConnectionFactory.java  2000/10/21 05:20:22     1.10
jCD>   +++ XAConnectionFactory.java  2000/10/25 23:54:37     1.11
jCD>   @@ -39,7 +39,7 @@
jCD>     * connection, the same previous connection will be returned.  Otherwise,
jCD>     * you won't be able to share changes across connections like you can with
jCD>     * the native JDBC 2 Standard Extension implementations.</P>
jCD>   - * @version $Revision: 1.10 $
jCD>   + * @version $Revision: 1.11 $
jCD>     * @author Aaron Mulder ([EMAIL PROTECTED])
jCD>     */
jCD>    public class XAConnectionFactory extends PoolObjectFactory {
jCD>   @@ -78,7 +78,7 @@
jCD>                    if(pool.isInvalidateOnError()) {
jCD>                        pool.markObjectAsInvalid(evt.getSource());
jCD>                    }
jCD>   -                closeConnection(evt, XAResource.TMFAIL);
jCD>   +//                closeConnection(evt, XAResource.TMFAIL);
jCD>                }
   
jCD>                public void connectionClosed(ConnectionEvent evt) {
jCD>   @@ -87,11 +87,16 @@
   
jCD>                private void closeConnection(ConnectionEvent evt, int status) {
jCD>                    XAConnection con = (XAConnection)evt.getSource();
jCD>   +                try {
jCD>   +                    con.removeConnectionEventListener(listener);
jCD>   +                } catch(IllegalArgumentException e) {
jCD>   +                    return; // Removed twice somehow?
jCD>   +                }
jCD>                    Transaction trans = null;
jCD>                    try {
jCD>                        if(tm.getStatus() != Status.STATUS_NO_TRANSACTION) {
jCD>                            trans = tm.getTransaction();
jCD>   -                        XAResource res = 
(XAResource)rms.get(con);//con.getXAResource();
jCD>   +                        XAResource res = (XAResource)rms.get(con);
jCD>                            trans.delistResource(res, status);
jCD>                            rms.remove(con);
jCD>                        }
jCD>   @@ -99,7 +104,6 @@
jCD>                        Logger.exception(e);
jCD>                        throw new RuntimeException("Unable to deregister with 
TransactionManager: "+e);
jCD>                    }
jCD>   -                con.removeConnectionEventListener(listener);
   
jCD>                    if(!(con instanceof XAConnectionImpl)) {
jCD>                        // Real XAConnection -> not associated w/ transaction



Reply via email to