tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tang Jianyu <>
Subject A bug in tomcat6? MapperListener.registerHost, StandardServer.findService
Date Fri, 08 Jan 2010 03:08:11 GMT
Hi, everyone,

I am using tomcat6.0.20 and run it in Embedded mode and met a problem.
I wrote a class to create Embedded service with below code:

     final Embedded tomcatService = new Embedded();
     tomcatService.setCatalinaHome( catalinaHome );
     tomcatService.setName( "Embed Catalina" );

     final Engine engine = tomcatService.createEngine();
     engine.setName( "Embed Catalina" );

     final Host host = tomcatService.createHost( "localhost", "webapps" );

It's working pretty well when using tomcat 5.5.23. Bug when I upgrade
to 6.0.20, and ran it in debug mode, when it went into
MapperListener.registerHost, line 332

           Host host = (Host) ServerFactory.getServer().findService(

Now I have:
           this.domain = "Embed Catalina"
  = "localhost"
           name = "localhost"

And when I debug into StandardServer.findService(String name), now I have stack:

           name = "Embed Catalina" (which was passed by the value of
 [0].domain = "Embed Catalina"
 [0].name = null

So in this method:

       synchronized (services) {
           for (int i = 0; i < services.length; i++) {
               if (name.equals(services[i].getName())) {
                   return (services[i]);

can't find corresponding service and it will return null, which cause
NullPointerException and whole app will be exit.

Is there anyone know this? Is it a bug or I missed something? Is there
any workaround?

Thanks a lot.

Tang Jianyu

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

View raw message