Folks,
I found my main problem. It turned out that I had a trigger on the Card 
insert which inserted a record in another table using a FK which at insert 
time was still null.

I have two points to make:
1. The logging in the server just told me it was a SQL error, but it never 
gave any details. I had to change the 
org.jboss.resource.connectionmanager.LocalTxConnectionManager
class to log the linkedException. Can we print the messages in all linked 
exceptions when they are logged?
2. I still don't know why the transaction can fail during commit and not 
send notification back to the client.

Ciao,
Jonathan O'Connor
Ph: +353 1 872 3305
Mob: +353 86 824 9736
Fax: +353 1 873 3612




Jonathan.O'[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
13.11.2002 12:29
Please respond to jboss-user

 
        To:     [EMAIL PROTECTED]
        cc: 
        Subject:        [JBoss-user] TX Bug: Transaction failure not passed back to 
the client


We are implementing a workaround to allow NOT NULL foreign key columns to 
be set in ejbPostCreate.
We converted our NOT NULL constraints in our Oracle9 DB into NOT NULL 
DEFERABLE INITIALLY DEFERRED. This means that constraints are only checked 

at commit time. This is great because this lets us have non null foreign 
keys without changing the way JBoss (I'm on 3.0.4) works.

This seems to work for some of our entities. However, for our Card EJB 
shows the following strange behavior:
1. client code calls sessionBeanRemote.issueCard( ... );
2. JBoss automatically starts a transaction
3. SessionBean.issueCard(...) calls cardHome.create(...)
4. JBoss internally calls CardBean.ejbCreate, followed by 
CardBean.ejbPostCreate
5. SessionBean.issueCard() returns cardLocal.getPrimaryKey() to the client
6a. JBoss tries to call UPDATE for the ejbPostCreate stuff which seems to 
succeed.
6b. JBoss then tries to commit the transaction started in step 2, and 
fails, throwing an exception. The server logs show a stack trace of the 
problem.
6b. The client continues on after calling sessionBeanRemote.issueCard(...) 

as if nothing went wrong.

Some questions come to mind:
a) Why is the client not told of the exception?
b) Why is the UPDATE command executed long after cardHome.create() has 
returned? Is this a "Don't trust the order of the logs" problem?
c) What is causing the XaException?

Here's the relevant pieces of my log:

[Steps 1 and 2]
2002-11-13 11:37:00,043 INFO 
[xcom.traxbahn.bproc.bcomponents.ejb.CardBcBean] Getting ChangeControl for 

changeControlId: 1
[Step 3 and 4]
2002-11-13 11:37:00,234 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Card] Create: 
pk=383
2002-11-13 11:37:00,234 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Card] Executing 
SQL: SELECT COUNT(*) FROM T_CARD WHERE T_CARD_ID=?
2002-11-13 11:37:00,244 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Card] Executing 
SQL: INSERT INTO T_CARD (T_CARD_ID, PAN, EXPIRY_DATE, HOST_ID, VALID_FROM, 

PRODUCT_TYPE, HAS_PIN, HAS_CARD, STATUS, CREDITLIMIT, TMPLIMIT, 
TMPLIMITVALID, OVERDRAFT, OVERDRAFTVALID, OVERPAY, RISKDETECTED, 
REISSUE_CODE, REPLACE_ID, REPLACE_DATE, T_PERSON_ID, AUTHPROFILE, 
RISKPROFILE, OWNPROFILE, T_CHANGECONTROL_ID, T_ACCOUNT_ID, 
STATEMENT_ADDRESS, DELIVERY_ADDRESS) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 

?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2002-11-13 11:37:00,264 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Card] Rows 
affected = 1
[Step 4]
2002-11-13 11:37:00,334 DEBUG [xcom.traxbahn.baseentity.ejb.CardBean] 
PostCreate: accountId=275 stmtAddr=288 billingAddr=288
[Step 5]
2002-11-13 11:37:00,334 DEBUG 
[xcom.traxbahn.bproc.bcomponents.ejb.CardBcBean] Issued New Card 
ThinCardDTO:
------------
cardID: 383
pan 4539782720326763
expiryDate: 2003.06
productType Cirrus

[Step 6a]
2002-11-13 11:37:00,334 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Card] Executing 
SQL: UPDATE T_CARD SET STATEMENT_ADDRESS=?, DELIVERY_ADDRESS=? WHERE 
T_CARD_ID=?
2002-11-13 11:37:00,344 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Card] Rows affected 

= 1
[Step 6b]
2002-11-13 11:37:00,384 WARN  [org.jboss.tm.TxCapsule] XAException: 
tx=XidImpl [FormatId=257, GlobalId=XCOM-IRL-JONATHAN//9, BranchQual=] 
errorCode=XA_UNKNOWN(0)
javax.transaction.xa.XAException: could not commit local 
txjavax.resource.ResourceException: SQLException
        at 
org.jboss.resource.connectionmanager.LocalTxConnectionManager$LocalConnectionEventListener.commit(LocalTxConnectionManager.java:567)
        at org.jboss.tm.TxCapsule.commitResources(TxCapsule.java:1714)
        at org.jboss.tm.TxCapsule.commit(TxCapsule.java:393)
        at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:73)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:201)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
        at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
        at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
        at 
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
        at org.jboss.ejb.Container.invoke(Container.java:712)
        at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
        at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
        at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
        at java.lang.Thread.run(Thread.java:536)

Lastly, my environment is: Windows 2000 for client and JBoss 3.0.4 server 
using Sun's JVM 1.4.1, Oracle 9i running on a Linux box.
Ciao,
Jonathan O'Connor
Ph: +353 1 872 3305
Mob: +353 86 824 9736
Fax: +353 1 873 3612


-------------------------------------------------------
This sf.net email is sponsored by: Are you worried about 
your web server security? Click here for a FREE Thawte 
Apache SSL Guide and answer your Apache SSL security 
needs: http://www.gothawte.com/rd523.html
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user





-------------------------------------------------------
This sf.net email is sponsored by: Are you worried about 
your web server security? Click here for a FREE Thawte 
Apache SSL Guide and answer your Apache SSL security 
needs: http://www.gothawte.com/rd523.html
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to