tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: problem deploying J2EE RI-built EAR/WAR file
Date Fri, 17 Nov 2000 23:02:49 GMT
Hi Tim, see intermixed.

Tim Bond wrote:

> Hi,
>
> I'm trying to get a WAR file created with the J2EE reference
> implementation deployment tool to deploy on Tomcat 4.0.  The new
> env-entry feature (as of 11/1) is working.  Here's part of my web.xml
> file:
>
> <servlet>
>     <servlet-name>vlweb</servlet-name>
>     <display-name>vlweb</display-name>
>     <description>no description</description>
>     <jsp-file>/index.jsp</jsp-file>
>   </servlet>
>   <session-config>
>     <session-timeout>30</session-timeout>
>   </session-config>
>   <env-entry>
>     <description>no description</description>
>     <env-entry-name>rmiserver</env-entry-name>
>     <env-entry-value>tester.mitre.org</env-entry-value>
>     <env-entry-type>java.lang.String</env-entry-type>
>   </env-entry>
>
> We are having two problems:
>
> 1.  If I start the server with just the .war file, two levels of
> directories are created (webapps/vltrack/vltrack) instead of one
> (webapps/vltrack).
>

Is the "vltrack" subdirectory present inside your WAR file?  If so, it should not
be -- in other words, you should create the WAR file by running JAR from *within*
the document root of the web app, and WEB-INF/ should be a top level entry.

This isn't Tomcat-specific ... it's what the servlet 2.2 and 2.3 specs require
for webapp directory structure.

>
> 2.  I added a leading '/' to the jsp-file parameter below because
> Tomcat threw the following error at startup:
>
> 2000-11-17 15:36:42 StandardHost[localhost]: Deploying web application
> at context path /vltrack from URL
> file:e:\jakarta-tomcat-4.0\webapps\vltrack
> 2000-11-17 15:36:42 ContextConfig[/vltrack] Configuration error in
> application web.xml
> java.lang.IllegalArgumentException: JSP file index.jsp does not start
> with a / character
>  at
> org.apache.catalina.core.StandardWrapper.setJspFile(StandardWrapper.java:311)
>

Oh yes, the infamous "leading slash" issue :-).  A little history might prove to
be of interest.

The servlet 2.2 spec didn't clearly specify whether context-relative paths like
<jsp-file> should have leading slashes or not.  (By the way, this is made
explicit for 2.3.)  In an attempt to be user friendly and helpful, Tomcat 3.0 --
which was the basis for the web container in the J2EE 1.2 RI -- included some
kludge (IMHO) patches to add the slash if the user didn't put them there!  And,
because it was the RI, other people apparently copied the same approach.

Right now, Tomcat 4.0 is very pedantic about what it accepts in the web.xml file,
trying to rigorously enforce all the rules of the 2.3 spec that it can.  This is
very useful to developers who want to ensure that webapps they develop on Tomcat
will run on any 2.3-compliant container.  Unfortunately, it creates a backwards
compatibility problem for existing 2.2 apps.

As a result, Tomcat 4.0 is going to need to be modified to accept web.xml files
*without* the leading slashes if you declare that your web app conforms to the
2.2 DTD, but require the leading slashes if you claim compliance to the 2.3 DTD.
This will aid in the ability to run old (2.2) apps under the new container, which
is required by the 2.3 spec.

I anticipate that these changes will be made in time for the next milestone
(probably still a week away).

For the record, the DTD elements that this applies to include at least the
following:
* <jsp-file> in a <servlet> definition
* <location> in an <error-page> definition.
* <form-login-page> in a <form-login-config> definition.
* <form-error-page> in a <form-login-config> definition.

>
> This WAR deployed on both J2EE RI and Weblogic 5.1 so it seems there
> may be a slight bug here.
>
> --- Tim

Craig McClanahan



Mime
View raw message