[jboss-user] [JNDI/Naming/Network] - Re: jboss-client.jar really needed for Tomcat?

jaikiran do-not-reply at jboss.com
Tue May 20 09:15:38 EDT 2008


"henk53" wrote : 
  | I do wonder, but perhaps this is not a question for this forum, why a JNDI connection to the Jboss AS directory can't be made without exposing the jboss-client-jar to the client application. 
  | 
  | The reason I'm asking is that I'm building an application where the dependencies should be as few as is reasonably possible. As much as possible should be defined at the servlet or AS level.

Remember that JNDI (similar to JDBC) is just a set of interfaces. There are various JNDI service providers. Tomcat has its own JNDI service and JBoss has its own. So when a client in Tomcat wants to use JBoss JNDI service, the client has to pass the appropriate properties (similar to what you do with JDBC DriverManager to load the appropriate drivers). The properties are usually passed through a jndi.properties file or through the constructor of the InitialContext class. Here's an example:


Properties props = new Properties();
  | 			props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
  | 			props.put(Context.PROVIDER_URL,"jnp://localhost:1099");
  | 			
  | 			Context ctx = new InitialContext(props); 
  | 

As a result, you will have to package the required jar files (again, similar to your JDBC driver jars) with the client.  Kazuhisa is right, you can package the jbossall-client.jar with the client to access the JNDI service of JBoss.



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

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



More information about the jboss-user mailing list