ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google

Mail Archive Home | enhydra List | August 2005 Index

<--  Date Index  --> <--  Thread Index  -->

help: bug? when using a default context in tomcat/enhydra

we have a enhydra application which, on the dev environment, is "listening" 
under the url http://localhost:8080/alpinPortal2/Portal.po

What i wanted to achieve is that this application will also
accept incoming requests of the type


--- side note ---
(Actually, I want this application to grab "all" requests for whatever
url is coming in, since we will then have a Filter/HttpServletRequestWrapper
that will "rewrite" static urls into dynamic urls:

To register the Filter i have put the following into web.xml of the


Our UrlRewritingFilter will then call a ServletRequestWrapper to rewrite
the url. So far, so good. I get urls of the type 
and can rewrite the url so that Portal.po will be called with the correct
But, for now, simply forget about this filter. It just works.

--- end side note ---

Now, I would also like to get rid of the "alpinPortal2" part. So a call
to "http://localhost:8080/Portal.po"; should go to our application.
If I try to write such an url, tomcat will not forward the request to the
application, since that resides under the "alpinPortal2" path.

I then tried to change the server.xml for tomcat such as to have a
"default context" definition:

    <Context path="" docBase="alpinPortal2" debug="0" crossContext="true" />
or: <Context path="" docBase="alpinPortal2" debug="0" />

That kind of solved the issue: now, whatever url i type, it will be passed
on the the enhydra application, since i mapped path="" to

But then i noticed a problem:

our application is instantiated twice!!! The startup() method is called
and i notice that i have two enhydra applications running! why?

One of them looks "normal", has a member variable contextMBean, so that i
call contextMBean.getAppContext() to see that the application is
I can also call contextMBean.getAppRealContext and see the local path on my

The second application instead, has a "null" contextMBean!!! Strange?

Strangely enough, whenever i call a url like
http://localhost:8080/Portal.po, it will be passed to the "first"
application. Everything ok. Even all the other calls, like 
http://localhost:8080/foo/bar/whatever get passed to the "first"
My filter works just fine.

When i call http://localhost:8080/alpinPortal2/Portal.po, this request
gets passed to the "second" application (the one with the "null"
contextMBean). It works, but the fact of not having a contextMBean is
irritating - and more than that, i cannot really accept having two
applications floating around and one of them catching some requests.

Does anybody have a clue as to why this is so?
Is there a better way to have tomcat pass all requests to a single enhydra
application? Why is using the context entry in server.xml instantiating
two applications?

I imagine that, in production environment, i will do this by a director
configuration or apache rewriting rule, but it's kind of necessary to
have the same feature on the standalone enhydra ide/tomcat suite that
we use for development.

Even though I spent a lot of debugging on this, i have no real insight
as to how to solve the issue.
Thanks for everybody that comes up with a helpful hint.


http://www.alpin.it         software, consulting & strategy

Christoph Moar                          Dipl. Inform. Univ.
alpin gmbh srl          management & technology consultants
tel +39 0471 056007 fax +39 0471 056005 gsm +39 348 3057012
lanciastr. 8b  via lancia 8b    bozen 39100 bolzano   italy
http://www.alpin.it                 christoph.moar@xxxxxxxx

<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.