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 2006/01/27 21:22:02 UTC

DO NOT REPLY [Bug 38427] New: - ServletContextListener Notified Multiple Times When Using Virtual Hosting

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=38427>.
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=38427

           Summary: ServletContextListener Notified Multiple Times When
                    Using Virtual Hosting
           Product: Tomcat 5
           Version: 5.5.12
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: kevin.l.janise@accenture.com


The ServletContextListener is getting notified multiple times when virtual 
hosting is used.

I created an app and deployed it under the Tomcat 5.5.15\webapps directory 
where it worked as expected. 

I then deployed the same app using virtual hosting and found that the 
ServletContextListener is notified 2 times. If I put a static counter variable 
in it the variable does not get incremented. 

A Singleton registry object I created shows that items are getting registered 
into it 2 times, I'm logging when items are registered in it. But no exception 
is generated. I throw an exception if objects are being bound using the same 
name. It seems there are 2 of them in existence.

Here is the entry I'm using in the server.xml file to set up the virtual 
hosting.

      <Host name="test.struts"
            appBase="C:/Data/Projects/test"
            unpackWARs="true"
            autoDeploy="true"
            xmlValidation="false"
            xmlNamespaceAware="false">

         <Alias>www.test.struts</Alias>

         <Context path="" docBase="test.struts" reloadable="true" debug="0">
             <Resource
               name="jdbc/test"
               type="javax.sql.DataSource"
               password="password"
               driverClassName="com.mysql.jdbc.Driver"
               maxIdle="2"
               maxWait="5000"
               validationQuery="SELECT 1"
               username="root"
               url="jdbc:mysql://localhost:3306/test"
               maxActive="4"/>
         </Context>
      </Host>

I also get the same behavior under the 5.5.15 version. That wasn't an 
available option I could select when filling in the report.

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


DO NOT REPLY [Bug 38427] - ServletContextListener Notified Multiple Times When Using Virtual Hosting

Posted by bu...@apache.org.
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=38427>.
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=38427


yoavs@computer.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
            Version|5.5.12                      |5.5.15




------- Additional Comments From yoavs@computer.org  2006-04-13 20:23 -------
5.5.15 is an available option now, so I'm updating the version.

I wonder if each Host (virtual or not) gets its own classloader: that would
explain the behavior you're seeing.  To confirm that hunch, to something like
System.out.println(getClass().getClassloader().toString()) from your Listener. 
And if that hunch is confirmed, and you truly want a single object across
multiple classloaders, put that object in a different repository (e.g.
common/lib instead of WEB-INF/lib).

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