[jboss-user] [JNDI and Naming] - Cannot map java:/JmsXA to web app resource as java:comp/env/jms/JmsXA

chris.wolf do-not-reply at jboss.com
Tue Apr 23 11:27:12 EDT 2013


chris.wolf [https://community.jboss.org/people/chris.wolf] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/809836#809836

--------------------------------------------------------------
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 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 http://www.jboss.org/j2ee/schema" version="5.1"
     xs:schemaLocation=" http://www.jboss.org/j2ee/schema http://www.jboss.org/j2ee/schema
      http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd 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#440879 https://community.jboss.org/message/440879#440879
 https://community.jboss.org/thread/47131?tstart=0 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 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
[https://community.jboss.org/message/809836#809836]

Start a new discussion in JNDI and Naming at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130423/3ab073f1/attachment-0001.html 


More information about the jboss-user mailing list