tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: Adding a webapp via the API to a running instance
Date Mon, 20 Jun 2011 16:56:28 GMT
Hi Benson,

On 20.06.2011 17:51, Benson Margulies wrote:
> Reading org.apache.catalina.startup.Tomcat.addWebapp(Host, String,
> String, String), I don't understand the following:
>         // prevent it from looking ( if it finds one - it'll have dup error )
>         ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
> Why is this being used to prevent the code from seeing a web.xml in
> the basedir/conf?

I'd say it is not.

Have a look at ourr test suite. It uses the jsp servlet without
programmatically configuring. I'm pretty sure it comes from the global
web.xml. The test suite also logs

... org.apache.catalina.startup.ContextConfig webConfig
... INFO: No global web.xml found

but that doesn't keep it from executing JSPs.

For instance TestAbstractHttp11Processor deploys test/webapp-3.0 and
calls /echo-params.jsp. The basics are in TomcatBaseTest.

So I'd say there's something wrong in your setup.


> On Mon, Jun 20, 2011 at 11:31 AM, Benson Margulies
> <> wrote:
>> I'm using import org.apache.catalina.startup.Tomcat to embed tomcat.
>> After it is running, I'm trying to add another webapp with .addWebapp.
>> The addWebapp call logs:
>> 2011-06-20 11:23:23,385 ["http-bio-9167"-exec-2] INFO
>> org.apache.catalina.util.LifecycleBase - The start() method was called
>> on component [Realm[Simple]] after start() had already been called.
>> The second call will be ignored.
>> 2011-06-20 11:23:23,387 ["http-bio-9167"-exec-2] INFO
>> org.apache.catalina.startup.ContextConfig - No global web.xml found
>> This second message is odd, since there is a global web.xml sitting in
>> the conf subdirectory of the pathname I passed to Tomcat.setBaseDir.
>> However, this is followed in quick succession by an NPE. In
>>, jspServlet is null. Does it make sense that the
>> problem is the failure to find the global web.xml, since it would
>> define the jsp servlet? And, if so, why does this work for my first
>> webpp (defined before 'start') and not for my second?
>> java.lang.NullPointerException
>>        at org.apache.catalina.startup.ContextConfig.convertJsp(
>>        at org.apache.catalina.startup.ContextConfig.convertJsps(
>>        at org.apache.catalina.startup.ContextConfig.webConfig(
>>        at org.apache.catalina.startup.ContextConfig.configureStart(
>>        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(
>>        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
>>        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
>>        at org.apache.catalina.core.StandardContext.startInternal(
>>        at org.apache.catalina.util.LifecycleBase.start(
>>        at org.apache.catalina.core.ContainerBase.addChildInternal(
>>        at org.apache.catalina.core.ContainerBase.addChild(
>>        at org.apache.catalina.core.StandardHost.addChild(
>>        at org.apache.catalina.startup.Tomcat.addWebapp(
>>        at org.apache.catalina.startup.Tomcat.addWebapp(
>>        at org.apache.catalina.startup.Tomcat.addWebapp(

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

View raw message