You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Paliwoda <jp...@bybaxter.com> on 2002/12/27 21:35:59 UTC

Remote access to Tomcat's naming service

Does anyone know how to get an InitialContext to Tomcat's naming service from outside of Tomcat's JVM? The documentation only describes how to get it from within Tomcat. I imagine it will look something like the following:

Hashtable env = new Hashtable(); 
env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory"); 
env.put("java.naming.provider.url", "iiop://localhost:1091"); 
Context ic = new InitialContext(env);

Also, is there a way to use Tomcat's naming service to hold references to remote objects? That is, can I have a class that inherits UnicastRemoteObject or PortableRemoteObject with a stub (created with rmic) in a Tomcat JVM and have it executed from outside of Tomcat?
Thanks,
John

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Remote access to Tomcat's naming service

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 27 Dec 2002, John Paliwoda wrote:

> Date: Fri, 27 Dec 2002 14:35:59 -0600
> From: John Paliwoda <jp...@bybaxter.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Remote access to Tomcat's naming service
>
> Does anyone know how to get an InitialContext to Tomcat's naming service
> from outside of Tomcat's JVM? The documentation only describes how to
> get it from within Tomcat. I imagine it will look something like the
> following:
>
> Hashtable env = new Hashtable();
> env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
> env.put("java.naming.provider.url", "iiop://localhost:1091");
> Context ic = new InitialContext(env);
>

Remote access to the InitialContext supplied to Tomcat-based webapps is
not supported.  Even if it were, the usefulness would pretty small since
many objects (such as javax.sql.DataSources) stored there are not
Serializable and therefore not accessible from remote JVMs anyway.

> Also, is there a way to use Tomcat's naming service to hold references
> to remote objects? That is, can I have a class that inherits
> UnicastRemoteObject or PortableRemoteObject with a stub (created with
> rmic) in a Tomcat JVM and have it executed from outside of Tomcat?

This would be feasible, if you build your own JNDI ObjectFactory.  See the
docs for more info -- there's a section on providing your own custom
resources:

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

>
> Thanks,
> John

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>