HELP - JBoss 3.0.4/Oracle TopLink 9.0.3/JTS/Oracle (XADataSo
mhuneycu Jan 2, 2003 12:00 PM
"mhuneycu" wrote:"mhuneycu" wrote:"mhuneycu" wrote:
I have be looking through the posts and have not found much so
I wanted to ask the question myself. My configuration is JDK1.4.1_01,
Oracle 8.1.7, JBoss 3.0.4, Oracle TopLink 9.0.3 and I am using BMP for
my EJBs. I am trying to configure TopLink with External JTS so the
TopLink can participate in transactions, also I am use the Oracle XA
DataSource because some persistence may span database connections.
I copy the oracle-xa-service.xml from docs/examples/jca into server/all/deploy.
I then modify the configuration for my database, I am using the oracle
thin driver, but I did try the OCI8 driver. Also I am using the JDK 1.4
Oracle 9.2 JDBC Drivers.
I startup JBoss so far so good. But when I attempt to integrate with
TopLink I get the following problems:
1. Using the TopLink JNDIConnector I the following exception:
ERROR [STDERR] LOCAL EXCEPTION STACK:
EXCEPTION [TOPLINK-7060] (TopLink - 9.0.3 (Build 423)):
oracle.toplink.exceptions.ValidationException
EXCEPTION DESCRIPTION: Cannot acquire data source
[XATestDS].
INTERNAL EXCEPTION: javax.naming.InvalidNameException:
Not a compound name: XATestDS
The exception occurs wheter I specify initial context
properties such as Provider URL, Context Factory and Package,
or use the defaults from the container. I have tried every
combination to no avail. Below is the code:
DatabaseLogin login = project.getLogin();
Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.PROVIDER_URL,
"jnp://localhost:1099);
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
jndiProperties.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
Context context = InitialContext(jndiProperties);
JNDIConnector connector = new JNDIConnector(context,
"java:/XATestDS");
login.setConnector(connector);
........
serverSession.login(); <- This is when it occurs.
However I did find that I was able to get past the Invalid
Naming exception with this code. Basically I get the DataSource
myself and then pass it to the JNDIConnector.
DatabaseLogin login = project.getLogin();
Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.PROVIDER_URL,
"jnp://localhost:1099);
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
jndiProperties.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
Context context = InitialContext(jndiProperties);
javax.sql.DataSource ds =
(javax.sql.DataSource) JNDIHelper.lookup(
"java:/XATestDS");
JNDIConnector connector = new JNDIConnector(ds);
login.setConnector(connector);
........
serverSession.login(); No Exceptions.
So I got past the naming exceptions. My guess is that form some reason
TopLink if converting java:/XATestDS to XATestDS as other servers
like WebLogic use this form of naming. But that is pure speculation,
I am debugging to see if that is the case.
So I get past this problem only to find that neither an Oracle
XADataSource nor a regular Oracle DataSource will work.
I get exceptions in both cases. I have read on the forums that
the Oracle XA DataSource has problems, but I use it in WebLogic
and WebSphere pretty regularly without issue, so I am not sure
what the forum users means by buggy. With the following code
and the Oracle XA DataSource:
login.useExternalTransactionController();
String jtsControllerClassName =
oracle.toplink.jts.JTSExternalTransactionController
Class jtsControllerClass =
Thread.currentThread().getContextClassLoader().loadClass(jtsCon
trollerClassName);
ExternalTransactionController jtsController =
(ExternalTransactionController) jtsControllerClass.newInstance();
serverSession.setExternalTransactionController(jtsController);
login.useExternalConnectionPooling();
The class oracle.toplink.jts.JTSExternalTransactionController implements the
registration of a synchronization object according to the JTS 1.0 standard. Since
there is not JTSExternalTransactionController for JBoss supplied with TopLink as there
is in WebLogic and WebSphere, I had to use the generic one provided. With the above code
and an Oracle XA DataSource I get the following exception:
at org.jboss.resource.connectionmanager.
BaseConnectionManager2.allocateConnection
(BaseConnectionManager2.java:534)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$
ConnectionManagerProxy.
allocateConnection(BaseConnectionManager2.java:814)
at org.jboss.resource.adapter.jdbc.JDBCDataSource.getConnection(
JDBCDataSource.java:131)
at oracle.toplink.jndi.JNDIConnector.connect(Unknown Source)
at oracle.toplink.sessions.DatabaseLogin.connect(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.connect(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.connect(Unknown Source)
at oracle.toplink.threetier.ConnectionPool.buildConnection(Unknown Source)
at oracle.toplink.threetier.ExternalConnectionPool.startUp(Unknown Source)
at oracle.toplink.threetier.ServerSession.connect(Unknown Source)
at oracle.toplink.publicinterface.DatabaseSession.login(Unknown Source)
When I use the above code with a plain old Oracle DataSource I get a NullPointer
exception pointing with a message stating an exception occured within JTS.
I initiate a read first which works fine with the Oracle DataSource, but even
reads fail with the Oracle XA DataSource. The stack trace is the following:
at oracle.toplink.exceptions.ValidationException.jtsExceptionRai
sed(Unknown Source)
at oracle.toplink.jts.AbstractExternalTransactionController.getA
ctiveUnitOfWork(Unknown Source)
at oracle.toplink.publicinterface.Session.getActiveUnitOfWork(Un
INTERNAL STACK TRACE:
java.lang.NullPointerException
at oracle.toplink.jts.JTSExternalTransactionController.getExtern
alTransaction(Unknown Source)
at oracle.toplink.jts.AbstractExternalTransactionController.getA
ctiveUnitOfWork(Unknown Source)
at oracle.toplink.publicinterface.Session.getActiveUnitOfWork(Un
known Source)
Any help in this situation would be greatly appreciated.
Thanks
Mike H. Sr.