You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2005/09/24 22:38:56 UTC

DO NOT REPLY [Bug 36802] New: - Embeded Tomcat Initialises Context Twice

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36802>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36802

           Summary: Embeded Tomcat Initialises Context Twice
           Product: Tomcat 5
           Version: 5.5.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: darran@dalnet.plus.com


Using JBoss 4.0.2 (With embeded Tomcat 5.5.9) when a web application is deployed
the context is initialised twice.  If you deploy a web application with a valve
defined in 'WEB-INF/context.xml' of the application the valve will be registered
twice and invoked twice for any invocation of the application.

When Tomcat is run stand alone the deployer instantiates a new StandardContext
and adds it as a child to the StandardHost, this in turn invokes the init method
of the StandardContext - This correctly initialses the context based on the
configuration.

When Tomcat is embeded in JBoss the StandardContext is initialised, the host at
this stage is not available so JBoss invokes init on the StandardContext.  At
the top of the init method the context checks if it is associated with a parent
host as it is not the parent host is identified and the StandardContext added to
the parent.  The process of adding the context to the host causes the init
method of the context to be invoked again.

Although I have reported this against an older Tomcat version the affected code
has not been altered in the recent releases.

I will attach a patch that contains a proposed fix.  The proposed fix simply
checks if the context has been initialised before performing the initialisation,
if the initialisation has already been performed the initialisation is skipped.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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