tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject Re: Embedding Tomcat 7 in Apache OFBiz
Date Thu, 16 Jun 2011 07:54:57 GMT
2011/6/16 <>:
> Hi all,
> I'm one of the Apache OFBiz committer and I'm trying to migrate our embedded
> version of Tomcat 6 to 7 and I have discover a small issue when try to do this
> code:
> StandardWrapper defaultServlet = new StandardWrapper();
> defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet");
> defaultServlet.setServletName("default");
> defaultServlet.setLoadOnStartup(1);
> defaultServlet.addInitParameter("debug", "0");
> defaultServlet.addInitParameter("listing", "true");
> defaultServlet.addMapping("/");
> I'll receive an NullPointerException on org.apache.catalina.core.
> StandardWrapper.addMapping(
> Any hint to solve it ?

1. What exactly version of Tomcat 7.0.x ?

2. Why are you using this internal Tomcat class? What do you do with
StandardWrapper later?

3. Apparently the line that fails is the following:
(line numbers in the most recent Tomcat version differ from the one
you are mentioning)


I think it fails because parent is null.

So either
a) Add StandardWrapper as a child to a context.

- See StandardContext#createWrapper()
- See
 - o.a.c.startup.Tomcat#addServlet(..) (a helper class for embedding Tomcat)
 - o.a.c.deploy.WebXml#configureContext(..)
 - o.a.c.core.ApplicationContext#addServlet(String, Class)

b) If you want to change Tomcat code, file an issue in Bugzilla.

It should be easy to fix:  do not see why not to add parent!=null
check there. Though I do not know whether it will fail further down
the road.
The same may be said about similar code in removeMapping() method.

Best regards,
Konstantin Kolinko

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

View raw message