[jboss-user] [JNDI/Naming/Network] - Re: Using jndi from a web project

PeterJ do-not-reply at jboss.com
Wed Jul 22 17:49:59 EDT 2009


If you set use-java-context to true (the default), then the datasource name is actually "java:myname" based on your example (you can check with JNDIView to verify this).

However, you cannot connect to the java:/nyname name from a remote client - only apps deployed within JBoss AS can access things in the "java:" namespace.

I know that from a web app you need to provide a few configuration settings to get the connection made. First, you need to use this name:

java:comp/env/myname

then you need this entry in web.xml:

  <resource-ref>
  |     <res-ref-name>myname</res-ref-name>
  |     <res-type>javax.sql.DataSource</res-type>
  |     <res-auth>Container</res-auth>
  |     <res-sharing-scope>Shareable</res-sharing-scope>
  |   </resource-ref>

and this entry in WEB-INF/jboss-web.xml:

<jboss-web>
  |   <resource-ref>
  |     <res-ref-name>myname</res-ref-name>
  |     <jndi-name>java:myname</jndi-name>
  |   </resource-ref>
  | </jboss-web>

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4245417#4245417

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4245417



More information about the jboss-user mailing list