Thank you for your suggestions.

A URL connection to the manager application is an option, but I think the Servlet
option better fulfils my requirements.

I recently tried building the tool using an implementation of the ContainerServlet
and had some problems.  When I first tried to access the Servlet, I got the
following exception:

java.lang.NoClassDefFoundError: org/apache/catalina/ContainerServlet
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
 at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1643)

 at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:937)
 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1372)

 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1254)

 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:867)
 at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
 at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:652)

 at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)

 at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)

I then tried copying the catalina.jar file into the WEB-INF/lib directory of the
web app and I got this exception:

java.lang.InstantiationException:
com.epicentric.portlet.deployment.internal.TomcatModuleDeployer$TomcatModuleDeployerServlet

 at java.lang.Class.newInstance0(Class.java:281)
 at java.lang.Class.newInstance(Class.java:249)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:886)
 at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
 at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:652)

 at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)

 at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)

Does anyone know how to properly write an implementation of an
org.apache.catalina.ContainerServlet?

Thanks for the help.

Scott

Jean-Francois Arcand wrote:

> Scott Goldstein wrote:
>
> >I'm building a feature into a web application in which I need to deploy other
> >web applications to Tomcat programmatically.  I've taken a look at the
> >ManagerServlet for an example of how to do this and I have a quesion.
> >
> >1.  Is there any way to access the org.apache.catalina.Deployer instance
> >outside of a servlet?  In other words, do I have to write a Servlet which
> >implements the ContainerServlet interface?
> >
> If you are using the SecurityManager, you can't. You will need to change
> the catalina.policy file and add
> accessClassInPackage.org.apache.catalina. Be carefull and don't forget
> that others app will get access to those classes.
>
> >
> >The reason I ask, is that the code that handles the web application deployment
> >responsibilities currently is designed such that it does not have access to
> >the http request and response objects.  If possible, I would like to keep it
> >this way.  If I do, I can't do a RequestDispatcher.include() to a
> >ContainerServlet implementation, which appears to be the only way to access
> >the Deployer instance.
> >
> You can always use the Ant Tasks that comes with Tomcat and make some
> changes on it (specifically, the org.apache.catalina.DeployTask or use
> it directly.
>
> -- Jeanfrancois
>
> >
> >Do I have any other options?
> >
> >Thanks.
> >
> >Scott
> >
> >------------------------------------------------------------
> >"Just a mirror for the sun...
> > My smiling eyes are just a mirror for the sun."
> >------------------------------------------------------------
> >
> >
> >--
> >To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to