You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael McElligott <mi...@liquidplanet.com> on 2001/04/12 06:11:03 UTC

Two Depressed Questions

They're depressed because apparently nobody read them when I posted previously. ;) Or maybe nobody had the answers.  These are two questions I'm still hoping for a response on.  I'm hoping for Craig-like knowledge, but someone else who does have the same configuration but doesn't have the same problems would also have useful information..

1.  I have a listener registered in a web application.  This listener receives the appropriate callbacks.  One of the methods called is: contextInitialized(ServletContextEvent event).  The body of the method I've written there adds a few things to the ServletContext and then starts a background thread to do some processing.  The problem is: Tomcat will not serve anything when I include this listener.  Similarly, when I had that same code in a .jsp file, the .jsp file never finished processing (I never got data back in the browser, as I should have).  The .jsp file _did_ finish when I was not spawning this background thread.

2.  I set up two virtual hosts in server.xml in addition to the default host, which I left as-shipped.  They each contain a context with a path = "".  When I access 'www.host1.com:8080' I get the correct results.  When I access 'www.host2.com:8080' I get a 503 error.  Eliminating either entry allows the other to work.  It appears to be a "Clash of the Contexts", where two contexts cannot have the same name, regardless of the host in which they are nexted.  The following log error suggests something in this area too:

2001-04-05 05:33:37 StandardContext[]: Error initializing naming context for context 
2001-04-05 05:33:37 StandardContext[]: Context startup failed due to previous errors

Any knowledge and help is appreciated.

Mike

Re: AW: Two Depressed Questions

Posted by Tim O'Neil <ti...@xythos.com>.
That reminds me. I seem to recall reading in the
Apache docs that if you are doing any virtual hosting
you should do away with the default host and make all
your hosts (including what was the default) virtual.
Mr. Busse' comments would seem to validate that.

At 04:52 PM 4/12/2001 +0200, you wrote:
>Maybe I can help you with the second question at least:
>
>I removed the default host and put several virtual hosts in
>my server.xml and some of them contain the same path "/". It
>works just beautifully. Maybe you throw out the default host
>like I did. If tomcat works like apache, it will use the
>first virtual host as default host anyway. Maybe there is
>also a problem using an empty "" path.
>
>cheers,
>*stefan
>
> > 2.  I set up two virtual hosts in server.xml in addition
> >     to the default host, which I left as-shipped.  They
> >     each contain a context with a path = "".  When I access
> >     'www.host1.com:8080' I get the correct results.  When
> >     I access 'www.host2.com:8080' I get a 503 error.
> >     Eliminating either entry allows the other to work.
> >     It appears to be a "Clash of the Contexts", where
> >     two contexts cannot have the same name, regardless of
> >     the host in which they are nexted.  The following log
> >     error suggests something in this area too:
> >     2001-04-05 05:33:37 StandardContext[]: Error initializing
> >     naming context for context
> >     2001-04-05 05:33:37 StandardContext[]: Context startup
> >     failed due to previous errors


AW: Two Depressed Questions

Posted by Stefan Busse <sb...@medienkontor-online.de>.
Maybe I can help you with the second question at least:

I removed the default host and put several virtual hosts in
my server.xml and some of them contain the same path "/". It 
works just beautifully. Maybe you throw out the default host
like I did. If tomcat works like apache, it will use the
first virtual host as default host anyway. Maybe there is
also a problem using an empty "" path.

cheers,
*stefan

> 2.  I set up two virtual hosts in server.xml in addition
>     to the default host, which I left as-shipped.  They 
>     each contain a context with a path = "".  When I access
>     'www.host1.com:8080' I get the correct results.  When 
>     I access 'www.host2.com:8080' I get a 503 error.  
>     Eliminating either entry allows the other to work.  
>     It appears to be a "Clash of the Contexts", where 
>     two contexts cannot have the same name, regardless of 
>     the host in which they are nexted.  The following log 
>     error suggests something in this area too:
>     2001-04-05 05:33:37 StandardContext[]: Error initializing
>     naming context for context 
>     2001-04-05 05:33:37 StandardContext[]: Context startup 
>     failed due to previous errors