[JBoss-user] Re: HELP - JBoss 3.0.4/Oracle TopLink 9.0.3/JTS/Oracle (XADataSource/DataSource) - Followup Info

2003-01-03 Thread Michael Huneycutt
I made some progress today. My problem with Transactions was a simple one from a 
Oracle DataSource Standpoint. In WebLogic you do not have to set the 
TransactionManager using the TopLink JTSSynchronizationListener, but in JBoss you do. 
So the following code fixed the problem with exception using the Oracle DataSource: 

javax.transaction.TransactionManager tm = 
(TransactionManager)JNDIHelper.lookup(java:/TransactionManager);
JTSSynchronizationListener.setTransactionManager(tm);


I still cannot get Oracle XA DataSources to work. I am still getting the XAER_RMERR I 
mentioned in my first email. I believe it is that the initxa.sql/initjvm.sql script 
has not been run in the database. But if anyone has other ideas on the Oracle XA 
DataSource that would be great thanks. 
By the way I also found out the problem with  TopLink JNDIConnector and 
InvalidNamingException not a CompoundName.  It is not a compound name, TopLink's 
JNDIConnector returns a CompositeName which JBoss does not handle.  After looking 
through the JBoss 3.0.4 code I noticed that it only seems to support CompoundName.  
Can anyone confirm that? 

Thanks 

Mike H. Sr. 



Mike H. Sr.
  
Michael Huneycutt Sr.
TRC - A perotsystems* Company
Email: [EMAIL PROTECTED] 
Office FL: (813) 891-6084 x47395
Office VA: (804) 934-0977
Cell: (804) 304-7655
URL:   www.trcinc.com
   www.perotsys.com




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] Re: HELP - JBoss 3.0.4/Oracle TopLink 9.0.3/JTS/Oracle (XADataSource/DataSource

2003-01-03 Thread Michael Huneycutt
Quick HOW-TO

Setting up: 
TopLink 9.0.3/Oracle (8.1.7,9.2,9.0)/Oracle XA 
DataSource/JBoss 3.0.4/JDK1.4.1

1. Run initjvm.sql and initxa.sql in the oracle databases
that you will be connecting to with the Oracle XA 
DataSources configured in JBoss. They can be 
found in $ORACLE_HOME/javavm/install. 

2. Get the latest Oracle JDBC Driver from 
http://technet.oracle.com. The one I used is the 
latest and is named ojdbc14.jar (not classes12.zip).

3. Copy $JBOSS_HOME/docs/examples/jca/
oracle-xa-service.xml to the appropriate 
$JBOSS_HOME/server/[all|default|minimal]/deploy 
and configure it for your database. 

4. Modify $JBOSS_HOME/server/[all|default|minimal]/conf/
jboss-service.xml to include the attribute pad true
for the XidFactory. It should look as follows: 
mbean code=org.jboss.tm.XidFactory 
name=jboss:service=XidFactory
attribute name=Padtrue/attribute
/mbean

5. In your code to connect up to JNDI using the TopLink
JNDIConnector you will need to lookup and get the 
DataSource yourself and pass it in the JNDIConnector
constructor. If you user the a jndi name string 
the JNDIConnector will generate a CompositeName, which
results in a InvalidNamingException - not a 
CompoundName. It appears that CompositeNames do not
work in JBoss 3.0.4. Here is some sample code: 

//jndiProperties are the your properties
Context context = InitialContext(jndiProperties);
javax.sql.DataSource ds =
(javax.sql.DataSource) context.lookup(
java:/XATestDS);
JNDIConnector connector = new JNDIConnector(ds);
login.setConnector(connector);

6. You will need to write code to lookup and get 
the JBoss TransactionManager and then use the 
TopLink JTSSynchronizationListener to set the
transaction manager so TopLink knows about it. 
The following code is an example: 
import javax.transaction.TransactionManager;
import oracle.toplink.jts.*;
..
TransactionManager tm = 
(TransactionManager)context.lookup(
transactionMgrJndiName);
JTSSynchronizationListener.
setTransactionManager(tm);

7. Finally you need to also set in TopLink the 
the external JTS Controller class and let 
TopLink know you want to use external
transactions. The generic TopLink class
JTSExternalTransactionController seems to 
work so far. An example: 

login.useExternalTransactionController();

String jtsControllerClassName = 
JTSExternalTransactionController;
Class jtsControllerClass =
Thread .currentThread()
.getContextClassLoader()
.loadClass(
jtsControllerClassName);
ExternalTransactionController jtsController =
(ExternalTransactionController)
jtsControllerClass
.newInstance();
serverSession.setExternalTransactionController(
jtsController);
login.useExternalConnectionPooling();


That does it. Hopefully this helps others who may
struggle as well. 



Mike H. Sr.
  
Michael Huneycutt Sr.
TRC - A perotsystems* Company
Email: [EMAIL PROTECTED] 
Office FL: (813) 891-6084 x47395
Office VA: (804) 934-0977
Cell: (804) 304-7655
URL:   www.trcinc.com
   www.perotsys.com




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] Re: HELP - JBoss 3.0.4/Oracle TopLink 9.0.3/JTS/Oracle (XADataSource/DataSource

2003-01-03 Thread Michael Huneycutt
Turns out that initxa.sql and initjvm.sql had not been run in the database I was 
trying to connect to. I confirmed this by connecting to a database that has JAVA_XA 
installed and the Oracle XA DataSource worked fine. 

Thanks 


Mike H. Sr.
  
Michael Huneycutt Sr.
TRC - A perotsystems* Company
Email: [EMAIL PROTECTED] 
Office FL: (813) 891-6084 x47395
Office VA: (804) 934-0977
Cell: (804) 304-7655
URL:   www.trcinc.com
   www.perotsys.com




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user