I have a third party application deployed in JBoss5.Third party application has provided us a AppClient.java class through which we can connect to it by instantiating and passing some connection proerties to it . Third party application takes some data and saves into database.
Now i have written a stand alone java class to connect to Thirdparty application and start the transactions as below.
InitialContext initialContext = appClientReference.getInitialContext();
tx = (UserTransaction)initialContext.lookup("UserTransaction");
//Begin transaction
tx.begin();
//do some db operations by calling third party logic
// Commit results
tx.commit();
Now i would like to remove the stand alone program and create a web application and deploy into Tomcat . So, my application will be in Tomcat and Third party applicatio is in JBoss . Now how can i start the transactions? I am using spring3. can i use any Spring configurations ?
You can always create your appClientReference instance using a spring bean.
<bean id="demoLookup"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="cache" value="true" />
<property name="lookupOnStartup" value="true" />
<property name="proxyInterface" value="your fully qualified look up business interface" />
<property name="jndiName" >
<value>contextName/ejbName/remote or local </value> // assuming you have not over ridden the default naming strategy.
</property>
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
<prop key="java.naming.provider.url">jnp://localhost:1099</prop>
<prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
</props>
</property>
</bean>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.