Ole,
Thanks for the reply. Here's the class I use - it's built with EJBDoclet.
package test;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.sql.DataSource;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
* This is a stateless session bean calling an empty stored procedure to
test
* sybase DB connections.
*
* @see <related>
* @author $Author: peter $
* @version $Revision: 1.1.1.1 $
*
* @stateless-session
* @ejb-name CallStoredProcedure
* @transaction Required
*/
public class CallStoredProcedureBean
implements SessionBean {
// Public --------------------------------------------------------
public SessionContext context;
/**
* callStoredProcedure.
*
* @remote-method
*/
public int callStoredProcedure(float amount) {
Connection con = null;
PreparedStatement ps = null;
try {
con = getConnection();
ps = con.prepareStatement("exec sp_null_procedure");
ResultSet rs = ps.executeQuery();
} catch(SQLException sql) {
System.out.println("Query failed" + sql);
throw new EJBException(sql);
} finally {
try {
if (ps != null) ps.close();
if (con != null) con.close();
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}
return 1;
}
/**
* Create CallStoredProcedure.
*
* @create-method
*/
public void ejbCreate() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void ejbRemove() {
}
public void setSessionContext(SessionContext ctx) {
}
private Connection getConnection() throws SQLException {
try {
InitialContext jndiContext = new InitialContext();
DataSource ds = (DataSource)
jndiContext.lookup("java:/SybaseDB");
return ds.getConnection();
} catch (NamingException ne) {
throw new EJBException(ne);
}
}
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Ole Husgaard
Sent: Tuesday, December 05, 2000 9:49 PM
To: jBoss
Subject: Re: [jBoss-User] Unexpected Transaction Exception
Hi,
This exception comes from an extra paranoia check
I added to TxCapsule in case somebody tries to
unregister a null XA resource.
Probably the real problem (if any) is in Minerva.
Looking at the Minerva source, it seems that the
XA resource has already been removed from the
HashMap, and it looks to me like this only can be
done after the resource was delisted from the
transaction.
Looks to me like a connectionClosed() event is
being posted twice, but I am not sure how this
could happen. After all, the connectionlistener
unregisters itself before delisting the resource.
Maybe the same listener is somehow being registered
twice with the same XAResourceImpl instance, but
that is unlikely as the listener only seems to be
registered in XAConnectionFactory.prepareObject().
The only way I can see this happening is if the
resource is obtained outside a transaction. In that
case the listener is registered, but the resource
is not added to the rms HashMap.
How does your callStoredProcedure() method look?
Best Regards,
Ole Husgaard.
Peter Jasko wrote:
>
> Hi,
>
> I got this server-side exception (once) when running a stress-test
> consisting of 4 clients repeatedly executing the same method on a
stateless
> session bean (CallStoredProcedure) which executes a stored procedure and
> returns an integer to the client.
>
> Any reasons why it might occur? I only saw it once in about 40,000
> invocations.
>
> TIA,
> Peter
>
> [CallStoredProcedure] java.lang.IllegalArgumentException: null xaRes
> [CallStoredProcedure] at
> org.jboss.tm.TxCapsule.delistResource(TxCapsule.java:
> 446)
> [CallStoredProcedure] at
> org.jboss.tm.TransactionImpl.delistResource(Transacti
> onImpl.java:101)
> [CallStoredProcedure] at
> org.jboss.minerva.factories.XAConnectionFactory$2.clo
> seConnection(XAConnectionFactory.java:101)
> [CallStoredProcedure] at
> org.jboss.minerva.factories.XAConnectionFactory$2.con
> nectionClosed(XAConnectionFactory.java:86)
> [CallStoredProcedure] at
> org.jboss.minerva.xa.XAConnectionImpl.clientConnectio
> nClosed(XAConnectionImpl.java:116)
> [CallStoredProcedure] at
> org.jboss.minerva.xa.XAClientConnection.close(XAClien
> tConnection.java:225)
> [CallStoredProcedure] at
> test.CallStoredProcedureBean.callStoredProcedure(Call
> StoredProcedureBean.java:64)
> [CallStoredProcedure] at java.lang.reflect.Method.invoke(Native Method)
> [CallStoredProcedure] at
> org.jboss.ejb.StatelessSessionContainer$ContainerInte
> rceptor.invoke(StatelessSessionContainer.java:472)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.StatelessSessionInstanceInterce
> ptor.invoke(StatelessSessionInstanceInterceptor.java:87)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxI
> nterceptorCMT.java:133)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransac
> tions(TxInterceptorCMT.java:263)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInter
> ceptorCMT.java:99)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.SecurityInterceptor.invoke(Secu
> rityInterceptor.java:144)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterc
> eptor.java:192)
> [CallStoredProcedure] at
> org.jboss.ejb.StatelessSessionContainer.invoke(Statel
> essSessionContainer.java:271)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoke
> r.invoke(JRMPContainerInvoker.java:163)
> [CallStoredProcedure] at java.lang.reflect.Method.invoke(Native Method)
> [CallStoredProcedure] at
sun.rmi.server.UnicastServerRef.dispatch(Unknown
> Sour
> ce)
> [CallStoredProcedure] at sun.rmi.transport.Transport$1.run(Unknown
Source)
> [CallStoredProcedure] at
> java.security.AccessController.doPrivileged(Native Me
> thod)
> [CallStoredProcedure] at sun.rmi.transport.Transport.serviceCall(Unknown
> Sourc
> e)
> [CallStoredProcedure] at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(Unk
> nown Source)
> [CallStoredProcedure] at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.
> run(Unknown Source)
> [CallStoredProcedure] at java.lang.Thread.run(Unknown Source)
> [CallStoredProcedure] TRANSACTION ROLLBACK EXCEPTION:null; nested
exception
> is:
>
> javax.ejb.EJBException
> [CallStoredProcedure] java.lang.RuntimeException: Unable to deregister
with
> Tran
> sactionManager: java.lang.IllegalArgumentException: null xaRes
> [CallStoredProcedure] at
> org.jboss.minerva.factories.XAConnectionFactory$2.clo
> seConnection(XAConnectionFactory.java:106)
> [CallStoredProcedure] at
> org.jboss.minerva.factories.XAConnectionFactory$2.con
> nectionClosed(XAConnectionFactory.java:86)
> [CallStoredProcedure] at
> org.jboss.minerva.xa.XAConnectionImpl.clientConnectio
> nClosed(XAConnectionImpl.java:116)
> [CallStoredProcedure] at
> org.jboss.minerva.xa.XAClientConnection.close(XAClien
> tConnection.java:225)
> [CallStoredProcedure] at
> test.CallStoredProcedureBean.callStoredProcedure(Call
> StoredProcedureBean.java:64)
> [CallStoredProcedure] at java.lang.reflect.Method.invoke(Native Method)
> [CallStoredProcedure] at
> org.jboss.ejb.StatelessSessionContainer$ContainerInte
> rceptor.invoke(StatelessSessionContainer.java:472)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.StatelessSessionInstanceInterce
> ptor.invoke(StatelessSessionInstanceInterceptor.java:87)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxI
> nterceptorCMT.java:133)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransac
> tions(TxInterceptorCMT.java:263)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInter
> ceptorCMT.java:99)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.SecurityInterceptor.invoke(Secu
> rityInterceptor.java:144)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterc
> eptor.java:192)
> [CallStoredProcedure] at
> org.jboss.ejb.StatelessSessionContainer.invoke(Statel
> essSessionContainer.java:271)
> [CallStoredProcedure] at
> org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoke
> r.invoke(JRMPContainerInvoker.java:163)
> [CallStoredProcedure] at java.lang.reflect.Method.invoke(Native Method)
> [CallStoredProcedure] at
sun.rmi.server.UnicastServerRef.dispatch(Unknown
> Sour
> ce)
> [CallStoredProcedure] at sun.rmi.transport.Transport$1.run(Unknown
Source)
> [CallStoredProcedure] at
> java.security.AccessController.doPrivileged(Native Me
> thod)
> [CallStoredProcedure] at sun.rmi.transport.Transport.serviceCall(Unknown
> Sourc
> e)
> [CallStoredProcedure] at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(Unk
> nown Source)
> [CallStoredProcedure] at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.
> run(Unknown Source)
> [CallStoredProcedure] at java.lang.Thread.run(Unknown Source)
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]