jBoss 5.1.0 - Multiple Instance of Web Application end Up Using Same JCA Resource
sjunejo May 31, 2011 7:51 AMHi Guys,
I am having a problem while deploying two instance of same web application each trying to use different JCA connection factory but end up using same even though I have defined different in jboss-web.xml. I am using jBoss 5.1.0. Both of my application has jboss-classloading.xml present as follows;
jboss-classloading.xml
<?xml version="1.0" encoding="UTF-8"?>
<classloading xmlns="urn:jboss:classloading:1.0"
name="ABC.war"
domain="DefaultDomain"
export-all="NON_EMPTY"
import-all="true">
</classloading>
My first copy of ABC is called ABCLive.war and resource reference are defined in deployment descriptor and application server binding files are as follows;
ABCLive.war
web.xml
<resource-ref id="ResourceRef_ABCConnectionFactory">
<description>ABC</description>
<res-ref-name>jca/abcConnectionFactory</res-ref-name>
<res-type>com.....ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
jboss-web.xml
<resource-ref>
<res-ref-name>jca/abcConnectionFactory</res-ref-name>
<res-type>com.....ConnectionFactory</res-type>
<jndi-name>java:jca/abcConnectionFactoryLIVE</jndi-name>
</resource-ref>
ABCTest.war
web.xml
<resource-ref id="ResourceRef_ABCConnectionFactory">
<description>ABC</description>
<res-ref-name>jca/abcConnectionFactory</res-ref-name>
<res-type>com.....ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
jboss-web.xml
<resource-ref>
<res-ref-name>jca/abcConnectionFactory</res-ref-name>
<res-type>com.....ConnectionFactory</res-type>
<jndi-name>java:jca/abcConnectionFactoryTEST</jndi-name>
</resource-ref>
Both of the above connection factories are defined in my 'abc-ds.xml' and pointing to two different DB servers locations but all my requests are using first connection factory and going to same DB server.
Let say if I remove definition of 'jca/abcConnectionFactoryTEST' from my 'abc-ds.xml' and try to use ABCTest instance it give me proper exception that JCA not bound or Lookup failed, but as soon as I use ABCLive which works fine and then try again to use ABCTest it starts working by using the jca/abcConnectionFactoryLive which is incorrect because it is confgiured to use abcConnectionFactoryTest.
I hope I am making sense. Please help sort out this problem and let me know if you need more information on this.
Thanks,
--
SJunejo