This content has been marked as final. Show 2 replies
Is there a way of making such a JNDI lookup possible from a Servlet, without adding a <resource-ref> declaration to the web.xml file?
Yes you should be able to get theJCA CF by simply looking at the JNDI.
Just define the -ds.xml and deploy it in the JBoss, later on in the servlet(or any web component) just make this call
InitialContext context = new InitialContext(); ConnectionFactory cf = (ConnectionFactory)context.lookup(JNDINAME);
The ConectionFactory/JNDINAME should be defined in the -ds.xml at <connection-definition>/ <jndi-name> tags.
Check this for more details
Thanks for your feedback, Vicky. The trick is to define a <res-ref-name> not starting with "ra" nor "jdbc" in jboss-web.xml. Once I avoided using the "ra" JNDI context, my connection factories became accessible without declaring them in web.xml