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(
domain).getContainer().findChild(name);
Now I have:
this.domain = "Embed Catalina"
this.name = "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
MapperListener.domain)
this.services[0].domain = "Embed Catalina"
this.services[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: [email protected]
For additional commands, e-mail: [email protected]