Dirk,

If you are trying to access the Tomcat JNDI from an external program then you 
are most likely out of luck since it doesn't look as if Tomcat is exposing it 
via a port like JBoss does.

"Tomcat 4 provides a JNDI InitialContext implementation instance to web 
applications running under it"

Key words being "under it".  You can read for yourself at:

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html

If you want to access the JNDI from _within_ a Servlet then simply use:

Context jndiContext = new InitialContext() ;

If we have all misunderstood you and you are trying to access the JBoss JNDI 
from a standalone Tomcat then use this in your Servlet code:

Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
props.setProperty(Context.URL_PKG_PREFIXES,"org.jnp.interfaces");
props.setProperty(Context.PROVIDER_URL,"localhost:1099");
InitialContext jndiContext = new InitialContext(props);

Obviously change localhost if JBoss is running on a different machine.  You 
would also need to add a link to (linux) or copy the following files from 
$JBOSS_DIST/client to $CATALINA_HOME/lib :

jboss-client.jar
jboss-common-client.jar
jboss-j2ee.jar
jbosssx-client.jar
jnet.jar
jnp-client.jar
log4j.jar

Good luck.

> Message: 11
> From: "Dirk Storck" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: AW: [JBoss-user] Access InitialContext of Tomcat 4.0.2
> Date: Thu, 23 May 2002 15:39:08 +0200
> Reply-To: [EMAIL PROTECTED]
>
> No from a stand alone Tomcat
> Thanks !
>
> > How can I access the InitialContext of Tomcat from whithin an
> > external java
> > programm?

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to