• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Transaction Problem with WAS3.5

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai All,
I have two EJBs (ejb1, ejb2 ) which are deployed in two instances of WA3.5.
From one mothod of ejb1, I am looking up the second ejb (ejb2) ,getting its remote object (i am not atall calling any mothod of ejb2, just lookup only) and after that I am calling one sql query by getting the connection using Datasouce.
In this case I am getting the follwing remote exception. But i have observered that Then these two operations of ejb1 method (i,e getting the remote object of ejb2 and execution of sql query) are exccuting successfully. But the container is throwing the follwing exception while returning from the method .
If i comment either sql query execution or getting the remote object of ejb2, it is not giving any problem. And also if we deploy both ejbs in one instance only, Then also, i am not geeting any broblem with these two calls.
I have tested with different combinations of txn attributes. If i set the txn attribute of ejb1 as Txn_Required or Txn_Required_New or supports, It is giving the problem irrespective of ejb2 txn attrbute. If i set txn attribute of ejb1 as not supports or bean_managed, It is working fine.
The database is DB2.
The code, I was using is
"
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
parms.put(Context.PROVIDER_URL, "iiop://deepa:900");

InitialContext ic = new InitialContext(parms);

AlertsInfoEJBHome home=(AlertsInfoEJBHome)ic.lookup("com/americanexpress/alerts/ejb/AlertsInfoEJB");
AlertsInfoEJB a=home.create();

DataSource ds=(DataSource)ic.lookup("jdbc/GNSDB");
Connection con=ds.getConnection("db2admin","db2admin");

String sqlQuery="select * from customertable";
Statement st=con.createStatement(sqlQuery);
ResultSet rs=st.executeQuery();
"
The Remote exception I was geeting is
CORBA TRANSACTION_ROLLEDBACK 0 No; nested exception is: org.omg.CORBA.TRANSACTION_ROLLEDBACK: com.ibm.websphere.csi.CSITransactionRolledbackException: java.lang.Throwable(java.lang.String) java.lang.Exception(java.lang.String) java.io.IOException(java.lang.String) java.rmi.RemoteException(java.lang.String) com.ibm.websphere.csi.CSIException(java.lang.String) com.ibm.websphere.csi.CSITransactionRolledbackException(java.lang.String) void com.ibm.ejs.csi.TranStrategy.commit() void com.ibm.ejs.csi.TranStrategy.postInvoke(com.ibm.websphere.csi.EJBKey, com.ibm.ejs.csi.TxCookieImpl) void com.ibm.ejs.csi.TransactionControlImpl.postInvoke(com.ibm.websphere.csi.EJBKey, com.ibm.websphere.csi.TxCookie, com.ibm.websphere.csi.ExceptionType) void com.ibm.ejs.container.EJSContainer.postInvoke(com.ibm.ejs.container.EJSWrapper, int, com.ibm.ejs.container.EJSDeployedSupport) void com.americanexpress.alerts.eac.test.EJSRemoteEACTest.addDevice() org.omg.CORBA.portable.OutputStream com.americanexpress.alerts.eac.test._EJSRemoteEACTest_Tie._invoke(java.lang.String, org.omg.CORBA.portable.InputStream, org.omg.CORBA.portable.ResponseHandler) com.ibm.rmi.ServerResponse com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(com.ibm.rmi.ServerRequest) com.ibm.rmi.ServerResponse com.ibm.CORBA.iiop.ORB.process(com.ibm.rmi.ServerRequest) void com.ibm.CORBA.iiop.WorkerThread.run() void com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run() minor code: 0 completed: No
Thanks for any help!
Tnaks And Regards
S.Anjaneyulu
 
author
Posts: 3892
5
Redhat Quarkus Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You crossed from one machine to another. This means you now need a 2PC transaction. Thus, your JDBC driver has to be JTA enabled for this to work (there's a checkbox for this in the admin console of WAS 3.5).
Kyle
 
Anjaneyulu Sadineni
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
Thank you kyle for your replay.
I have some doubt. In our server we are having different applications deployed on diffetent instances of WAS3.5. Each application is having its own database pool configuration and all these are using same db2 driver.
If we set the JTA enabled for this db2 driver, Is it effects the peformance of all applications (other than my application) which are using this drivier. If it effects perfomance of other applications, I think that it is better to configure two db2 drivers (one is with JTA enabled and another one is without JTA enabled), and we can use JTA enabled driver for setting the data base pool configuration of my application and another JTA disabled driver for setting the data base pool configuration of other applications. Please give me the clarification about this one whether it is ok or not?.
And if poosible, please explain little bit elaborately what is JTA enabling of JDBC driver and Why this problem is coming if we are not enabled the driver for JTA. Otherwise, If there is any documentation available about this one in net, please send me the URL.
And, I am using VAJAVA for testing this problem with jdbc obdc db2 driver for getting the connection. If you know, Can you please tell me where i need to set this JTA enabled attribute for this driver.
Thanks for any further help.
Thanks And regards
S.Anjaneyulu
 
Kyle Brown
author
Posts: 3892
5
Redhat Quarkus Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you only need to JTA enable the driver in those cases where you will enlist a DataSource AND cross a machine boundary to get another EJB. Otherwise, in situations where you remain on a single machine, you can use a non-JTA enabled driver.
I'm pretty sure you can't enable the driver for JTA in VAJ. My book shows you how to do it for WAS on page 480, but I don't think it's supported in VAJ.
Kyle
 
reply
    Bookmark Topic Watch Topic
  • New Topic