https://bz.apache.org/bugzilla/show_bug.cgi?id=62090

--- Comment #5 from Slava Risenberg <slava.risenb...@gmail.com> ---
(In reply to Coty Sutherland from comment #0)
> When using a web.xml that specifies a servlet element, but excludes
> servlet-name a NPE is observed and the webapp fails to deploy. A check
> should be added in the StandardWrapper and it should throw a
> ServletException when servlet-name is missing.
> 
> To reproduce, add a serlvet tag to your web.xml with no servlet-name. For
> example:
> 
>   <servlet>
>     <servlet-class>com.example.servlets.HelloServlet</servlet-class>
>   </servlet>
> 
> Then start Tomcat and observe the exception in catalina.out:
> 
> SEVERE [main] org.apache.catalina.core.ContainerBase.addChildInternal
> ContainerBase.addChild: start:
>   org.apache.catalina.LifecycleException: Failed to initialize component
> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test].
> StandardWrapper[null]]
>     at
> org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.
> java:441)
>     ....
>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
> Caused by: java.lang.NullPointerException
>     at
> org.apache.tomcat.util.modeler.Util.objectNameValueNeedsQuote(Util.java:26)
>     at
> org.apache.catalina.core.StandardWrapper.
> getObjectNameKeyProperties(StandardWrapper.java:1619)
>     at
> org.apache.catalina.util.LifecycleMBeanBase.initInternal(LifecycleMBeanBase.
> java:61)
>     at
> org.apache.catalina.core.ContainerBase.initInternal(ContainerBase.java:885)
>     at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
>     ... 49 more
> 
> Setting xmlValidation="true" on the Context may handle this differently, but
> it's off by default so we should check for null and handle that case.

A check should be added to ContextConfig.configureContext() method as it is the
place where context is being populated with servlets properties.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to