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

It seems that XA driver is still not supported completely by Weblogic.

0 views
Skip to first unread message

Lee hwa syub

unread,
Oct 9, 2002, 2:07:39 AM10/9/02
to

Hi, Mitesh.

As you said, I modified my codes(attached below), which call java.sql.Connection,close()
after
javax.transaction.UserTransaction.commit(). But it still throwed the same SQLException,
Logical handle no longer valid.(attached below)

I can't believe that I can not close the connection until it commited or rolled
back.
According to Sun's JTA spec, 4.2 Transaction Association and Connection Request
Flow,
I can close the connection before connection commited or rolled back.

If I had used non-xa driver, maybe I should have closed the connections
after transaction, because of the limitation of non-xa driver.
But I used real xa driver, not non-xa driver.

I also test my codes with Microsoft SQLServer xa driver, and it throws the same
SQLException.
(attached below)

I aslo test my codes on Orion Server with Oracle xa driver. It succeed! (attached
below)

This problem is very serious for the product of my company, which should support
the distributed
transaction.

Could you explain the exact reason and how to solve?

Thank you.

Lee hwa syub.

===============================================================
<Test Configuration>
- JDK FullVersion : jdk1.3.1
- WebLogic Server Version : 6.1
- Service Pack Version : 3
- Platform & OS Version : Window2000 pro
- Other : Oracle 8.1.7, Oracle jdbc-driver 8.1.7.1

- JDBC Connection Pools :
Name: XAOraclePool
URL: jdbc:oracle:thin:@localhost:1521:gss
Driver Classname: oracle.jdbc.xa.client.OracleXADataSource
Properties
(key=value):
user=buyer
url=jdbc:oracle:thin:@localhost:1521:gss
password=buyer
dataSourceName=XAOraclePool

- JDBC Tx Data Sources :
Name: XAOracleDS
JNDI Name: XaOracle
Pool Name: XAOraclePool
v Enable Two-Phase Commit

===============================================================
#My test codes
Connection con1 = null;
Connection con2 = null;
Statement st = null;
ResultSet rs = null;
try{

Context ctx = new InitialContext();

UserTransaction ut = (UserTransaction)ctx.lookup(
"javax.transaction.UserTransaction");
// for Weblogic
ut.begin();

DataSource ds = (DataSource) ctx.lookup(
"XaOracle");
con1 = ds.getConnection();
DatabaseMetaData dbmd = con1.getMetaData();
rs = dbmd.getPrimaryKeys(null, "BUYER", "EMP");
while(rs.next())
{
System.out.println ("prim-key1:"+rs.getString(4));
}
rs.close();
rs =null;


con2 = ds.getConnection();

dbmd = con2.getMetaData();
rs = dbmd.getPrimaryKeys(null, "BUYER", "EMP"); //<--here! (TestMe.java:119)
while(rs.next())
{
System.out.println ("prim-key2:"+rs.getString(4));
}
rs.close();
rs =null;

ut.commit();

con1.close();
con1 =null;
con2.close();
con2 =null;

}catch (Exception e) {
e.printStackTrace();
}finally{
try{
if (rs != null) rs.close();
if (st !=null) st.close();
if (con1 != null) con1.close();
if (con2 != null) con2.close();
}catch (SQLException se) {
se.printStackTrace();
}
}

===============================================================
#When tested with Oracle
prim-key1:EMPNO
java.sql.SQLException: Logical handle no longer valid
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
at oracle.jdbc.driver.OracleConnection.checkPhyiscalStatus(OracleConnection.java:373)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:565)
at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:492)
at oracle.jdbc.OracleDatabaseMetaData.getPrimaryKeys(OracleDatabaseMetaData.java:2910)
at weblogic.jdbc.jta.DatabaseMetaData.getPrimaryKeys(DatabaseMetaData.java:638)
at weblogic.jdbc.rmi.internal.DatabaseMetaDataImpl.getPrimaryKeys(DatabaseMetaDataImpl.java:1118)
at weblogic.jdbc.rmi.SerialDatabaseMetaData.getPrimaryKeys(SerialDatabaseMetaData.java:2024)
at test.TestMe.testXAOracleGetPrimaryKeys(TestMe.java:119)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:166)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at junit.textui.TestRunner.doRun(TestRunner.java:74)
at junit.textui.TestRunner.start(TestRunner.java:234)
at junit.servletui.TestRunner$CoreTestRunner.start(TestRunner.java:86)
at junit.servletui.TestRunner$CoreTestRunner.main(TestRunner.java:99)
at junit.servletui.TestRunner.doGet(TestRunner.java:65)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2546)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2260)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

===============================================================
#When tested with SQLServer
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has been
closed.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbcx.base.BaseDatabaseMetaDataWrapper.closedException(Unknown
Source)
at com.microsoft.jdbcx.base.BaseDatabaseMetaDataWrapper.getPrimaryKeys(Unknown
Source)
at weblogic.jdbc.jta.DatabaseMetaData.getPrimaryKeys(DatabaseMetaData.java:638)
at weblogic.jdbc.rmi.internal.DatabaseMetaDataImpl.getPrimaryKeys(DatabaseMetaDataImpl.java:1118)
at weblogic.jdbc.rmi.SerialDatabaseMetaData.getPrimaryKeys(SerialDatabaseMetaData.java:2024)
at test.TestMe.testXAOracleGetPrimaryKeys(TestMe.java:120)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:166)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at junit.textui.TestRunner.doRun(TestRunner.java:74)
at junit.textui.TestRunner.start(TestRunner.java:234)
at junit.servletui.TestRunner$CoreTestRunner.start(TestRunner.java:86)
at junit.servletui.TestRunner$CoreTestRunner.main(TestRunner.java:99)
at junit.servletui.TestRunner.doGet(TestRunner.java:65)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2546)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2260)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

===============================================================
#When tested on Orion Server, it succeed!
prim-key1:EMPNO
prim-key2:EMPNO
===============================================================

Mitesh Patel

unread,
Oct 9, 2002, 10:55:00 AM10/9/02
to Lee hwa syub
Use the same connection which is still open.

con2 = ds.getConnection();
dbmd = con2.getMetaData();

instead try dbmd= con1.getMetaData() again.
Mitesh

Lee hwa syub

unread,
Oct 9, 2002, 9:19:15 PM10/9/02
to

Hi, Mitesh.
It works.
Thank you!
Lee hwa syub.
0 new messages