JBoss Community

Cannot map java:/JmsXA to web app resource as java:comp/env/jms/JmsXA

created by chris.wolf in JNDI and Naming - View the full discussion

Hello,

 

This is my first post.  I want to use a JMS ConectionFactory via a Resource Adapter, therefore I want the CF boud to "java:JmsXA".  I want to access this from a web application, but it cannot "see" this (returns null upon attempt to lookup).  I don't understand why this is an issue since the web app is in the same VM as the JBoss server.  I wonder if there are other isolation mechanisms to consider for web apps accessing the "java:" namespace?

 

I know that "JmsXA" can be reconfigured to be in the global namespace, but that will impact other applications on the server that expect it in the "java:" namespace, so that's not an option.

 

Then I read how these resources can be mapped into a web app's private ENC namespace:

 

http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/ENC_Usage_Conventions-Resource_Manager_Connection_Factory_References.html

 

So in my WEB-INF/web.xml, I put:

 

  <resource-ref>

    <res-ref-name>jms/JmsXA</res-ref-name>

    <res-type>javax.jms.ConnectionFactory</res-type>

    <res-auth>Container</res-auth>

  </resource-ref>

 

...and in WEB-INF/jboss-web.xml, I put:

 

<?xml version="1.0" encoding="UTF-8"?>

<jboss-web xmlns:xs="http://www.jboss.org/j2ee/schema" version="5.1"

     xs:schemaLocation="http://www.jboss.org/j2ee/schema

     http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">

  <resource-ref>

    <res-ref-name>jms/JmsXA</res-ref-name>

    <jndi-name>java:/JmsXA</jndi-name>

  </resource-ref>

</jboss-web>

 

Then in the web app code I tried to do a lookup for "java:comp/env/jms/JmsXA" but it returned null.

 

How can web app code access java:JmsXA??

 

I already searched this forum and FAQs, e.g.

 

https://community.jboss.org/message/440879#440879

https://community.jboss.org/thread/47131?tstart=0

 

but there's no info on web app code accessing java:JmsXA.

 

If I re-package my code as a Spring deployment and deploy using "Snowdrop", then the same code works and can access "java:JmsXA", but I'd rather

depoy as a web app.

 

http://www.jboss.org/snowdrop

 

Oh and it's JBoss-6.1.0  due to legacy apps, we have to stick with this old realease for now.

 

Thanks,

 

Chris

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community