You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Tang Jianyu <ji...@gmail.com> on 2010/01/08 04:08:11 UTC

A bug in tomcat6? MapperListener.registerHost, StandardServer.findService

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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: A bug in tomcat6? MapperListener.registerHost, StandardServer.findService

Posted by Tang Jianyu <ji...@gmail.com>.
Thank you! I tried 6.0.22, it's running well.

On Fri, Jan 8, 2010 at 11:26 AM, Konstantin Kolinko
<kn...@gmail.com> wrote:
> 2010/1/8 Tang Jianyu <ji...@gmail.com>:
>> (...)
>>
>> 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
>>
>
> It might be related to
> https://issues.apache.org/bugzilla/show_bug.cgi?id=47316
>
> Can you try a 6.0.22 release candidate,
> to eliminate the issues that were already fixed?
>
> See
> http://markmail.org/thread/df55xredhflfqnnn
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

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


Re: A bug in tomcat6? MapperListener.registerHost, StandardServer.findService

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/1/8 Tang Jianyu <ji...@gmail.com>:
> (...)
>
> 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
>

It might be related to
https://issues.apache.org/bugzilla/show_bug.cgi?id=47316

Can you try a 6.0.22 release candidate,
to eliminate the issues that were already fixed?

See
http://markmail.org/thread/df55xredhflfqnnn

Best regards,
Konstantin Kolinko

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