tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Darwin <>
Subject Re: Binding a servlet with a name to "global" context?
Date Thu, 16 Jun 2005 12:52:53 GMT
Jaran Nilsen wrote:

>Hello, I am creating a servlet which I want to be registered by a
>name, like JNDI, so that other applications running in Tomcat can look
>up this servlet and call methods directly on it in addition to
>accessing it via HTTP requests.
I don't think that's wise, and it probably violates the spec and/or can't
be made to work. What, for example, do you expect to happen when
one of those other apps calls a method that (directly or indirectly) invokes
getServletContext()?  Where are the "other applications" going to get
the HttpServletRequest and HttpServletResponse objects? A servlet is 
to run in a given environment - a servlet container. If you want general 
RPC, why
not just use RMI?

Or was your statement ambiguous and you just want other apps to look up the
URL in JNDI, then invoke it via HTTP (e.g., via a object).

>I have no problems registering it in the Context where the application
>is running, but I would like to register it outside of this context,
>more globally, so that the other applications can look it up. I try to
>register it in the java:comp/env and java:comp contexts but I get the
>message that "The Context is read only".

See the docs for setting up Factories, as is done for JDBC and Mail Session

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message