JTS StandAlone<->Spring Setup
mina.azib May 3, 2017 1:56 AMIm new to Narayana and JBoss in general, so I'm having a bit of difficulty setting up JTS to work with Spring.
I did the following:
1. Execute jts-jacorb-setup-env.[bat|sh] to put Narayana in the classpath
2. Copy default-jts-jbossts-jacorb-properties.xmlin to your CWD and rename it to jbossts-properties.xml
3. Put jacorb.properties into C:\Users\Mina\Documents\jacorb_config\etc\
4. ./bin/start-transaction-service.[bat|sh]
5. I followed the instructions from JBossTransactionsWithSpring on the application side
JTS starts started with -Djacorb.config.dir=C:\Users\Mina\Documents\jacorb_config and seems ok. The output looks like this:
INFO: base configuration loaded from classpath orb.properties
May 02, 2017 9:55:24 PM org.jacorb.config.JacORBConfiguration init
INFO: configuration jacorb loaded from file C:\Users\Mina\Documents\jacorb_config\etc\jacorb.properties
2017-05-02 21:55:24.156 INFO Property "jacorb.hashtable_class" is set to: java.util.Hashtable
2017-05-02 21:55:24.166 WARNING Warning - unknown codeset (Cp1252) - defaulting to ISO-8859-1
2017-05-02 21:55:24.171 INFO InterceptorManager started with 1 Server Interceptors, 1 Client Interceptors and 1 IOR Interceptors
2017-05-02 21:55:24.239 INFO oid:
00 19 39 0E 34 20 4A 3D 01 3F 02 ..9.4 J=.?.
object is activated
2017-05-02 21:55:24.242 INFO Using server ID (3382179795) for transient POA
2017-05-02 21:55:24.274 INFO base configuration loaded from classpath orb.properties
2017-05-02 21:55:24.276 INFO configuration jacorb loaded from file C:\Users\Mina\Documents\jacorb_config\etc\jacorb.properties
2017-05-02 21:55:24.276 INFO created ORBSingleton
2017-05-02 21:55:24.353 INFO ClientConnectionManager: created new ClientGIOPConnection to 192.168.1.168:53032 (6b143ee9)
Ready
2017-05-02 21:55:24.361 INFO ORB run
I dont see my main application connecting to JTS through Jacorb
The output looks like this:
INFO: Using JTA UserTransaction: org.springframework.transaction.jta.UserTransactionAdapter@5136d012
May 02, 2017 8:06:23 PM org.springframework.transaction.jta.JtaTransactionManager checkUserTransactionAndTransactionManager
INFO: Using JTA TransactionManager: com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple@5939a379
May 02, 2017 8:06:23 PM com.arjuna.ats.arjuna.recovery.TransactionStatusManager start
INFO: ARJUNA012170: TransactionStatusManager started on port 51874 and host 127.0.0.1 with service com.arjuna.ats.arjuna.recovery.ActionStatusService
So to me this indicates its launching a local transaction manager - so how do i configure it to the stand alone JTS?
The Configuration in my application:
<jdbc:embedded-database id="dataSource" type="H2" >
<jdbc:script location="classpath:create-db.sql" />
</jdbc:embedded-database>
<bean id = "UserDAOImpl" class="spring_app.UserDAOImpl">
<property name = "dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="jbossTransactionManager" class="com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple">
</bean>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<ref bean="jbossTransactionManager"></ref>
</property>
</bean>
The Main code in my application
public static void main(String[] args) throws InvalidName, SystemException {
com.arjuna.orbportability.ORB myORB = com.arjuna.orbportability.ORB.getInstance("NameService");
com.arjuna.orbportability.RootOA myOA = com.arjuna.orbportability.OA.getRootOA(myORB);
myORB.initORB(args, null);
ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
// HelloWorld obj = (HelloWorld) context.getBean("helloWorld");
// obj.getMessage();
UserDAO userDAOImpl = (UserDAO) context.getBean("UserDAOImpl");
User user = new User();
user.setId(100);
user.setEmail("blah");
user.setName("Name");
Address address = new Address();
address.setAddress("address");
address.setCountry("country");
address.setId(2000);
user.setAddress(address);
userDAOImpl.create(user);
List<User> users = userDAOImpl.getUsers();
System.out.println(users);
}
I start my application with -Djacorb.config.dir=C:\\Users\\Mina\\Documents\\jacorb_config
So in sum I dont know how to get the components to talk via Jacorb. Any guidance will be appreciated! Thank you!