You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Benson Margulies <bi...@gmail.com> on 2011/06/20 19:46:28 UTC

Running an old servlet with Tomcat 7.0.16 embedded API

Ranier,

I've now demonstrated that this is not about 'deferred launch' but
rather about an old servlet failing to be configured with the embedded
Tomcat class.

https://github.com/bimargulies/Tomcat-Solr-Test-Case

has been simplified. It makes the few required calls to set up the
Tomcat object. Then it calls addWebapp for the solr webapp, and it
failed with an NPE, due to the lack of the 'jsp' servlet from the
usual global web.xml.

The test cases you mentioned didn't bear on this case at all, I'll
look for some others.

--benson


On Mon, Jun 20, 2011 at 12:56 PM, Rainer Jung <ra...@kippdata.de> wrote:
> 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.
> HTH.
>
> Rainer
>
>> On Mon, Jun 20, 2011 at 11:31 AM, Benson Margulies
>> <bi...@gmail.com> 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
>>> ContextConfig.java, 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(ContextConfig.java:1360)
>>>        at org.apache.catalina.startup.ContextConfig.convertJsps(ContextConfig.java:1339)
>>>        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
>>>        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
>>>        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:316)
>>>        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>>>        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
>>>        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5103)
>>>        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
>>>        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
>>>        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
>>>        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
>>>        at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:509)
>>>        at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:483)
>>>        at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:171)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org