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/09/22 13:55:03 UTC

DO NOT REPLY [Bug 40580] New: - Multiple ServletContext objects for same web-app in 5.5.17, only one is the real one. Okay in 5.5.12

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

           Summary: Multiple ServletContext objects for same web-app in
                    5.5.17, only one is the real one. Okay in 5.5.12
           Product: Tomcat 5
           Version: Nightly Build
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: janekdb@gmail.com


Note: the version select list in ASF Bugzilla is missing 5.5.17 so I choose
Nightly Build instead.

My web-app is being supplied with the wrong ServletContext when the path is not
/. In general it is getting a different ServletContext for each path, but each
path gets the same ServletContext.

To check this the method "dump" dumps the attributes of the ServletContext
object and it's id.

When the method "dump" is invoked when requesting /index.html this dumped,

dump start
dump: application: org.apache.catalina.core.ApplicationContextFacade@1953685
dump: application: 26556037
dump: org.apache.catalina.jsp_classpath
dump: javax.servlet.context.tempdir
dump: intl-channel-attribute
dump: service-locator-default
dump: service-locator-intl-chid
dump: org.apache.catalina.resources
dump: org.apache.catalina.WELCOME_FILES
dump end

This is the "dump" method,

	private static void dump(ServletContext application) {
		System.out.println("dump start");
		System.out.println("dump: application: " + application.toString());
		System.out.println("dump: application: " + System.identityHashCode(application));

		for (Enumeration e = application.getAttributeNames(); e.hasMoreElements();) {
			String attrName = (String) e.nextElement();
			System.out.println("dump: " + attrName);
		}
		System.out.println("dump end");
	}

HOWEVER when a different path is requested the ServletContext is different and
has lost the attributes that were set on it, This is what I got when requesting
/search/search.html

dump start
dump: application: org.apache.catalina.core.ApplicationContextFacade@1a4dd95
dump: application: 27581845
dump: org.apache.catalina.jsp_classpath
dump: javax.servlet.context.tempdir
dump: org.apache.catalina.resources
dump: org.apache.catalina.WELCOME_FILES
dump end

In general different paths give different ServletContext and only /index.html
gives the ServletContext as it was initialised by the ServletContextListener.

I do not have this problem with 5.5.12.

The web-app is deployed as a directory containing WEB-INF, index.html etc

jsp> ls -d1 intl/W* intl/i* intl/search/search.html
intl/index.html
intl/search/search.html
intl/WEB-INF

This is the <Host> element

      <Host name="intl.development" debug="0" appBase="/opt/xl/web/jsp/intl"
       unpackWARs="false" autoDeploy="false" liveDeploy="false">
        <Context path="" docBase="" debug="0" allowLinking="true" />
      </Host>

What has changed between 5.5.12 and 5.5.17 to cause this and can I prevent it?

-- 
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 40580] - Multiple ServletContext objects for same web-app in 5.5.17, only one is the real one. Okay in 5.5.12

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





------- Additional Comments From janekdb@gmail.com  2006-09-22 13:16 -------
Thanks. I will look at updating my configuration.

This configuration is what I have been using since Tomcat 4.0. I cannot remember
the exact place the configuration came from.


-- 
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 40580] - Multiple ServletContext objects for same web-app in 5.5.17, only one is the real one. Okay in 5.5.12

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


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2006-09-22 12:02 -------
This is because you are using an invalid and unsupported configuration that only
ever worked by chance in previous versions. Fixes to various bugs now mean this
configuration doesn't work.

docBase should never be the same as appBase. You need to move the contents of
/opt/xl/web/jsp/intl to /opt/xl/web/jsp/intl/ROOT and change your configuration to:

<Host name="intl.development" debug="0" appBase="/opt/xl/web/jsp/intl"
       unpackWARs="false" autoDeploy="false" liveDeploy="false">
        <Context docBase="ROOT" debug="0" allowLinking="true" />
</Host>

I'd be interested in where you got this configuration from. Lots of people have
the same problem and I can't see anything in the Tomcat docs that says to do it
like this.

-- 
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