Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Undetected deferred constraint violation when using Oracle XA thin driver

1 view
Skip to first unread message

Richard Yee

unread,
Nov 23, 2004, 7:42:33 PM11/23/04
to
Hello,

Has anyone encountered the following problem:

1. A container-managed transaction is started upon session bean method invocation

2. Session bean method creates a CMP 2.0 entity bean mapped to an Oracle table containing a constraint that is "initially deferred", with the intent to purposefully violate the constraint

3. Session bean method returns, which signals to the container that the transaction should now be committed. At this point, Oracle should signal that the constraint that was "initially deferred" has been violated, and an exception should be thrown.

4. Unfortunately, there is no visible indication from the Weblogic EJB container that any error has occurred, and return is controlled to the calling client. The Oracle transaction itself, however, has been rolled back.

I am running the following configuration:

Weblogic: 8.1 sp2 (also tried sp3)
DB: Oracle 9.205
Driver: Oracle XA thin driver 9 (also tried 10)

One visible effect of all of this is that there seems to be some sort of JDBC connection timeout when Oracle fails to commit the transaction, so from the client point of view, there's a noticeable delay (in seconds) before the client regains execution control from the session bean method call.

Any ideas or solutions to this problem would be greatly appreciated.

Best Regards,
Richard

Joe Weinstein

unread,
Nov 23, 2004, 10:31:00 PM11/23/04
to

Richard Yee wrote:

Hi. Interesting problem. Could you turn on jdbc logging and show me the jdbc log file right
after the tx is supposed to have failed? If you can use the weblogic XA oracle driver I will
have another avenue for debug. My first curiosity is whether the DBMS ever does send an
exception to us during our call to commit().
Joe

Richard Yee

unread,
Nov 24, 2004, 4:52:05 PM11/24/04
to
Hi Joe,

Per your request, here's the JDBC logging output from the transaction scenario I described. The connection pool being used is configured with the Weblogic Oracle type 4 XA JDBC driver.

It should be noted that although the log shows that an SQLException is being thrown and caught, there is no visible indication on the server console or at the remote client that an error has occurred and the transaction has rolled back. The client receives a return value from the session bean method invocation and believes all is well.

Thanks for any help you can provide.

Best Regards,
Richard


-------------------------------------------------------------
JDBC log stream started at Wed Nov 24 13:30:21 PST 2004
-------------------------------------------------------------
DriverManager.initialize: jdbc.drivers = null
JDBC DriverManager initialized
registerDriver: driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@22c5148]
DriverManager.getDriver("jdbc:oracle:thin:@localhost:1521:CV2DEMO")
trying driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@22c5148]
getDriver returning driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@22c5148]
registerDriver: driver[className=weblogic.jdbc.oci.Driver,weblogic.jdbc.oci.Driver@243b3ae]
Parsing: SELECT 1 FROM DUAL
Executing: SELECT 1 FROM DUAL
registerDriver: driver[className=weblogic.jdbc.jts.Driver,weblogic.jdbc.jts.Driver@240ade1]
registerDriver: driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@240ae95]
SQLWarning: reason([BEA][Oracle JDBC Driver]Specified user name was not quoted and was, therefore, converted to all upper case.) SQLState()
java.sql.SQLException: [BEA][Oracle JDBC Driver]Oracle XA Error Occurred. Native Error: 2091
at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbcx.oracle.OracleImplXAResource.checkError(I)V(Unknown Source)
at weblogic.jdbcx.oracle.OracleImplXAResource.commit(Ljavax.transaction.xa.Xid;Z)V(Unknown Source)
at weblogic.jdbcx.base.BaseXAResource.commit(Ljavax.transaction.xa.Xid;Z)V(Unknown Source)
at weblogic.jdbc.jta.DataSource.commit(Ljavax.transaction.xa.Xid;Z)V(DataSource.java:962)
at weblogic.transaction.internal.XAServerResourceInfo.commit(Lweblogic.transaction.internal.ServerTransactionImpl;Ljavax.transaction.xa.Xid;ZZ)V(XAServerResourceInfo.java:1251)
at weblogic.transaction.internal.XAServerResourceInfo.commit(Lweblogic.transaction.internal.ServerTransactionImpl;ZZZ)Z(XAServerResourceInfo.java:482)
at weblogic.transaction.internal.ServerSCInfo.startCommit(Lweblogic.transaction.internal.ServerTransactionImpl;ZZ)V(ServerSCInfo.java:421)
at weblogic.transaction.internal.ServerTransactionImpl.localCommit(ZZ)V(ServerTransactionImpl.java:1803)
at weblogic.transaction.internal.ServerTransactionImpl.globalRetryCommit(II)V(ServerTransactionImpl.java:2434)
at weblogic.transaction.internal.ServerTransactionImpl.globalCommit()V(ServerTransactionImpl.java:2365)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit()V(ServerTransactionImpl.java:278)
at weblogic.transaction.internal.ServerTransactionImpl.commit()V(ServerTransactionImpl.java:244)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(Lweblogic.ejb20.internal.InvocationWrapper;Ljava.lang.Throwable;)V(BaseEJBObject.java:299)
at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(Lweblogic.ejb20.internal.InvocationWrapper;Ljava.lang.Throwable;)V(StatelessEJBObject.java:140)
at com.trs.cv.fmk.fdas.server.bands.factory.ejb.BandsFactory_ouo120_EOImpl.update(Ljava.util.Collection;)Lcom.trs.cv.fmk.fdas.common.response.IMSUpdateResult;(BandsFactory_ouo120_EOImpl.java:272)
at com.trs.cv.fmk.fdas.server.bands.factory.ejb.BandsFactory_ouo120_EOImpl_WLSkel.invoke(ILweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;Ljava.lang.Object;)Lweblogic.rmi.spi.OutboundResponse;(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic.rmi.extensions.server.RuntimeMethodDescriptor;Lweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;)V(BasicServerRef.java:477)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(Lweblogic.rmi.extensions.server.RuntimeMethodDescriptor;Lweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;)V(ReplicaAwareServerRef.java:108)
at weblogic.rmi.internal.BasicServerRef$1.run()Ljava.lang.Object;(BasicServerRef.java:420)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedExceptionAction;)Ljava.lang.Object;(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedExceptionAction;)Ljava.lang.Object;(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(Lweblogic.rmi.spi.InboundRequest;)V(BasicServerRef.java:415)
at weblogic.rmi.internal.BasicExecuteRequest.execute(Lweblogic.kernel.ExecuteThread;)V(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
SQLException: SQLState(HY000)
java.sql.SQLException: [BEA][Oracle JDBC Driver]Oracle XA Error Occurred. Native Error: 24756
at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbcx.oracle.OracleImplXAResource.checkError(I)V(Unknown Source)
at weblogic.jdbcx.oracle.OracleImplXAResource.commit(Ljavax.transaction.xa.Xid;Z)V(Unknown Source)
at weblogic.jdbcx.base.BaseXAResource.commit(Ljavax.transaction.xa.Xid;Z)V(Unknown Source)
at weblogic.jdbc.jta.DataSource.commit(Ljavax.transaction.xa.Xid;Z)V(DataSource.java:962)
at weblogic.transaction.internal.XAServerResourceInfo.commit(Lweblogic.transaction.internal.ServerTransactionImpl;Ljavax.transaction.xa.Xid;ZZ)V(XAServerResourceInfo.java:1251)
at weblogic.transaction.internal.XAServerResourceInfo.commit(Lweblogic.transaction.internal.ServerTransactionImpl;ZZZ)Z(XAServerResourceInfo.java:482)
at weblogic.transaction.internal.ServerSCInfo.startCommit(Lweblogic.transaction.internal.ServerTransactionImpl;ZZ)V(ServerSCInfo.java:421)
at weblogic.transaction.internal.ServerTransactionImpl.localCommit(ZZ)V(ServerTransactionImpl.java:1803)
at weblogic.transaction.internal.ServerTransactionImpl.globalRetryCommit(II)V(ServerTransactionImpl.java:2434)
at weblogic.transaction.internal.ServerTransactionImpl.globalCommit()V(ServerTransactionImpl.java:2365)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit()V(ServerTransactionImpl.java:278)
at weblogic.transaction.internal.ServerTransactionImpl.commit()V(ServerTransactionImpl.java:244)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(Lweblogic.ejb20.internal.InvocationWrapper;Ljava.lang.Throwable;)V(BaseEJBObject.java:299)
at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(Lweblogic.ejb20.internal.InvocationWrapper;Ljava.lang.Throwable;)V(StatelessEJBObject.java:140)
at com.trs.cv.fmk.fdas.server.bands.factory.ejb.BandsFactory_ouo120_EOImpl.update(Ljava.util.Collection;)Lcom.trs.cv.fmk.fdas.common.response.IMSUpdateResult;(BandsFactory_ouo120_EOImpl.java:272)
at com.trs.cv.fmk.fdas.server.bands.factory.ejb.BandsFactory_ouo120_EOImpl_WLSkel.invoke(ILweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;Ljava.lang.Object;)Lweblogic.rmi.spi.OutboundResponse;(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic.rmi.extensions.server.RuntimeMethodDescriptor;Lweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;)V(BasicServerRef.java:477)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(Lweblogic.rmi.extensions.server.RuntimeMethodDescriptor;Lweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;)V(ReplicaAwareServerRef.java:108)
at weblogic.rmi.internal.BasicServerRef$1.run()Ljava.lang.Object;(BasicServerRef.java:420)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedExceptionAction;)Ljava.lang.Object;(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedExceptionAction;)Ljava.lang.Object;(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(Lweblogic.rmi.spi.InboundRequest;)V(BasicServerRef.java:415)
at weblogic.rmi.internal.BasicExecuteRequest.execute(Lweblogic.kernel.ExecuteThread;)V(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
SQLException: SQLState(HY000)

Joe Weinstein

unread,
Nov 24, 2004, 7:39:29 PM11/24/04
to

Richard Yee wrote:

> Hi Joe,
>
> Per your request, here's the JDBC logging output from the transaction
>scenario I described. The connection pool being used is configured with
>the Weblogic Oracle type 4 XA JDBC driver.
>
> It should be noted that although the log shows that an SQLException is
> being thrown and caught, there is no visible indication on the server
> console or at the remote client that an error has occurred and the
>transaction has rolled back. The client receives a return value from
> the session bean method invocation and believes all is well.
>
> Thanks for any help you can provide.
>
> Best Regards,
> Richard

Hi Richard. As you see, the driver does throw an exception during the commit,
and I do not *suspect* that the driver is catching it, nor is our pooling
or JTA JDBC stuff. However, I did see that our internal transactional engine
may retry a commit() after a failure, under some conditions... If you can send
me the DDL to create a deferred constraint and duplicate this problem, I will
see about a fix.
Joe

Jacek Laskowski

unread,
Feb 7, 2005, 8:33:46 AM2/7/05
to
Hi,

I'm also experiencing the issue and wondering whether it's been fixed in the latest SPs? It looks so similar. Hopefully, it's already fixed in a CR, as SP3 (WLS 8.1 on HP-UX/Itanium) shows it's not.

Jacek

Joe Weinstein

unread,
Feb 7, 2005, 1:40:21 PM2/7/05
to

Jacek Laskowski wrote:

Hi. Oracle has provided us with a pre-release version of the thin driver that
fixes this issue. If you give me an email address, I'll send it to you.
Joe

0 new messages