tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Running two versions of servlet in same tomcat instance
Date Sun, 18 Sep 2011 19:19:12 GMT
Hi.

Change the <url-pattern> of your test application, to be exactly the same as the 
<url-pattern> of the production application.

And invoke it as "http://yourhost.cpy.com/testvsb/", followed by the same "rest of URL" as

what you use for the main application.

Brief explanation : the <url-pattern> is *relative* to the "webapp name".  The "webapp

name" is the name of your application's directory (in other words, the name of the first 
directory level under (tomcat_dir)/webapps/).

.. Except one special case : the "default application" lives under the path 
(tomcat_dir)/webapps/ROOT/ (in capitals), but its "webapp name" is "/".

If the above does not work, then show us how the directory structure under 
(tomcat_dir)/webapps/ looks like, and which URL you use to access the production application.



Tod Olson wrote:
> I would like to run two versions of the same servlet (same servlet-class, but with different
WAR filename, servlet-name and url-pattern) under a single instance of Tomcat 6.0.33.  Basically,
the aim  is to run both test and production versions of the servlet under the same instance.
 Better to run them under separate instances, but getting a suitable second instance is proving
difficult.  I thought that the same servlet-class would be fine as long as the servlet-name
and url-pattern were different, but does not seem to be enough.
> 
> The problem I encounter is that while the production version is deployed by Tomcat just
fine, the test version is not loaded. The test version is unbundled in web apps directory
and there is a deployment message in the catalina log, but when I point a web browser to the
servlet, the result is just HTTP 404 error: "The requested resource (/testvsb/) is not available."
 
> 
> I've been unable to find any kind of useful debugging clues in the catalina logs, like
a servlet deployment or invocation error, but my knowledge of Tomcat is meagre.
> 
> The web.xml files for the two servlets are included below, in case they are of interest.
The init-param sections are the same because I'm still testing out the two-servlets-in-one-tomcat
concept on my laptop.
> 
> Any ideas or advice on how to proceed would be appreciated.
> 
> -Tod
> 
> 
> Tod Olson <tod@uchicago.edu>
> Systems Librarian     
> University of Chicago Library
> 
> 
> browse.war
> browse/WEB-INF/web.xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
> 
>    <servlet>
>      <servlet-name>Browse</servlet-name>
>   	<servlet-class>edu.ncsu.lib.browse.Browse</servlet-class>
>   	<init-param>
>     	<param-name>vsiUrl</param-name>
>     	<param-value>http://localhost/~tod/virtualshelfindex/handler/</param-value>
>     	<!-- <param-value>http://your.url.here/virtualshelfindex/</param-value>
-->
>     	<!-- <param-value>http://webdev.lib.ncsu.edu/virtualshelfindex/</param-value>
 -->
>    	</init-param>
>      <init-param>
>        <param-name>libraryName</param-name>
>        <param-value>The University of Chicago Library</param-value>
>      </init-param>
>      <init-param>
>        <param-name>libraryShortName</param-name>
>        <param-value>UChicago</param-value>
>      </init-param>
>      <init-param>
>        <param-name>catalogBaseUrl</param-name>
>        <param-value>http://notus.lib.uchicago.edu/staging/</param-value>
>      </init-param>
>      
>    </servlet>
>     
>   <servlet-mapping>
>     <servlet-name>Browse</servlet-name>
>     <url-pattern>/browse/*</url-pattern>
>   </servlet-mapping>
>   
>   <session-config>
>     <session-timeout>
>             30
>         </session-timeout>
>   </session-config>
>   <welcome-file-list>
>     <welcome-file>
>             browse
>         </welcome-file>
>   </welcome-file-list>
>  <error-page>
>   	<exception-type>
>   		java.lang.Exception
>   	</exception-type>
>   	<location>
>   		/jsp/error.jsp
>   	</location>
>   </error-page>
> </web-app>
> 
> 
> testvsb.war:
> testvsb/WEB-INF/web.xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
> 
>    <servlet>
>      <servlet-name>TestVSB</servlet-name>
>   	<servlet-class>edu.ncsu.lib.browse.Browse</servlet-class>
>   	<init-param>
>     	<param-name>vsiUrl</param-name>
>     	<param-value>http://localhost/~tod/virtualshelfindex/handler/</param-value>
>     	<!-- <param-value>http://your.url.here/virtualshelfindex/</param-value>
-->
>     	<!-- <param-value>http://webdev.lib.ncsu.edu/virtualshelfindex/</param-value>
 -->
>    	</init-param>
>      <init-param>
>        <param-name>libraryName</param-name>
>        <param-value>The University of Chicago Library</param-value>
>      </init-param>
>      <init-param>
>        <param-name>libraryShortName</param-name>
>        <param-value>UChicago</param-value>
>      </init-param>
>      <init-param>
>        <param-name>catalogBaseUrl</param-name>
>        <param-value>http://notus.lib.uchicago.edu/staging/</param-value>
>      </init-param>
>      
>    </servlet>
>     
>   <servlet-mapping>
>     <servlet-name>TestVSB</servlet-name>
>     <url-pattern>/testvsb/*</url-pattern>
>   </servlet-mapping>
>   
>   <session-config>
>     <session-timeout>
>             30
>         </session-timeout>
>   </session-config>
>   <welcome-file-list>
>     <welcome-file>
>             browse
>         </welcome-file>
>   </welcome-file-list>
>  <error-page>
>   	<exception-type>
>   		java.lang.Exception
>   	</exception-type>
>   	<location>
>   		/jsp/error.jsp
>   	</location>
>   </error-page>
> </web-app>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


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


Mime
View raw message