You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Patrick Lee <pa...@horologe.com.au> on 2007/03/04 12:38:06 UTC

Tomcat 6 - includes broken

Hi,

I'm trying to upgrade from Tomcat 5.5.15 to 6.0.10. Everything seems
to have gone fine except that most of my includes are broken.

I can do this:

<%@include file = "something.jsp" %>

But I can't do this:

<%@include file = "/path/to/something.jsp" %>

The latter gives me a status 500 and "File not found" on the include.

This is independent of the content of the file I'm trying to include.

Does anyone know what might have changed from 5.5.15 to 6.0.10 for
htins to happen? Do I need to change some configurations?

Thanks

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


Re: Tomcat 6 - includes broken

Posted by Rémy Maucherat <re...@gmail.com>.
On 3/4/07, Patrick Lee <pa...@horologe.com.au> wrote:
> I would assume it works in general and is specific to my instance here.
>
> Note that
>
> <%@include file = "/path/to/something.jsp" %>
>
> works fine if I am inside the root directory of the webapp, If however
> I have that include inside /somewhere/file.jsp then it always gives me
> a File not found.

No, that works fine (I did spend the time to test it, and as I said,
the test suite will test this feature). This is the same mechnism for
request dispatching, so I assume we would know it if it was not
working.

> If I put /path/to/something.jsp inside the directory /somewhere/ it is
> then able to find the include - which looks to me like the leading
> slash in the include is having no effect and the path is relative to
> the current path and not the webapp root?

No.

Rémy

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


Re: Tomcat 6 - includes broken

Posted by Patrick Lee <pa...@horologe.com.au>.
I would assume it works in general and is specific to my instance here.

Note that

<%@include file = "/path/to/something.jsp" %>

works fine if I am inside the root directory of the webapp, If however
I have that include inside /somewhere/file.jsp then it always gives me
a File not found.

If I put /path/to/something.jsp inside the directory /somewhere/ it is
then able to find the include - which looks to me like the leading
slash in the include is having no effect and the path is relative to
the current path and not the webapp root?

On 3/4/07, Rémy Maucherat <re...@gmail.com> wrote:
> On 3/4/07, Patrick Lee <pa...@horologe.com.au> wrote:
> > But I can't do this:
> > <%@include file = "/path/to/something.jsp" %>
>
> It works for me (this will be tested in the TCK, so there can't be any
> regressions on this sort of feature). The path is still relative to
> the webapp root, of course.
>
> Rémy
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: Tomcat 6 - includes broken

Posted by Rémy Maucherat <re...@gmail.com>.
On 3/4/07, Patrick Lee <pa...@horologe.com.au> wrote:
> But I can't do this:
> <%@include file = "/path/to/something.jsp" %>

It works for me (this will be tested in the TCK, so there can't be any
regressions on this sort of feature). The path is still relative to
the webapp root, of course.

Rémy

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


Re: Tomcat 6 - includes broken

Posted by Patrick Lee <pa...@horologe.com.au>.
> Do you have your host appBase set to be the same as your webapp
> docBase?

Yes, the context docBase is set at "."

Easy enough for me to change that and I'm guessing there are good
reasons not to have a setup like that.

Thanks.

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


Re: Tomcat 6 - includes broken

Posted by Mark Thomas <ma...@apache.org>.
Patrick Lee wrote:
> Apologies for all the replies but has setting a default context
> changed? I noticed this page linked on the Configuration Reference -
> http://tomcat.apache.org/tomcat-6.0-doc/config/defaultcontext.html.
> 
> Unfortunately, this page gives me a 404.

That link has been removed in svn. The default configuration settings
for all contexts are set in $CATALINA_HOME/conf/context.xml

Mark

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


Re: Tomcat 6 - includes broken

Posted by Patrick Lee <pa...@horologe.com.au>.
Apologies for all the replies but has setting a default context
changed? I noticed this page linked on the Configuration Reference -
http://tomcat.apache.org/tomcat-6.0-doc/config/defaultcontext.html.

Unfortunately, this page gives me a 404.

Thanks.

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


Re: Tomcat 6 - includes broken

Posted by Patrick Lee <pa...@horologe.com.au>.
Thanks everyone. Much appreciated.

I think part of my confusion was that when I create a directory to
deploy into, I have to remove subdirectories from the appBase because
it finds them first there before it looks in the ROOT directory I'm
deploying into.

This may be as intended but it was somewhat confusing when I've only
ever used the old style deployment I picked up years ago.



On 3/6/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > From: Patrick Lee [mailto:patrick@horologe.com.au]
> > Subject: Re: Tomcat 6 - includes broken
> >
> > <Host name="www.something.com." debug="0" appBase="c:/wwwroot/path/"
> >        unpackWARs="true" autoDeploy="true"
> >        xmlValidation="false" xmlNamespaceAware="false">
> >     <Context path="" docBase="." debug="0" privileged="true"/>
> > </Host>
> >
> > This is what's not working. Additionally, If I do set the docBase to
> > something else then it serves paths under the root relative to the
> > appBase, not the docBase.
>
> Which is exactly what it's supposed to do.  A docBase of "." is never,
> never correct.  As others have pointed out, you should stop trying to
> force use of the old deployment mechanism, and use the current, more
> robust one.
>
> 1) Remove the <Context> element from server.xml.
>
> 2) Remove the existing webapps/ROOT directory.
>
> 3) Deploy your app in C:/wwwroot/path/ROOT.war (or C:/wwwroot/path/ROOT,
> if expanded).
>
> 4) Create a META-INF/context.xml file in your webapp containing a
> <Context> element with only a privileged="true" attribute (if you really
> need even that).  You may alternatively place this <Context> element in
> conf/Catalina/www.something.com/ROOT.xml, if desired.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


RE: Tomcat 6 - includes broken

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Lee [mailto:patrick@horologe.com.au] 
> Subject: Re: Tomcat 6 - includes broken
> 
> <Host name="www.something.com." debug="0" appBase="c:/wwwroot/path/"
>        unpackWARs="true" autoDeploy="true"
>        xmlValidation="false" xmlNamespaceAware="false">
>     <Context path="" docBase="." debug="0" privileged="true"/>
> </Host>
> 
> This is what's not working. Additionally, If I do set the docBase to
> something else then it serves paths under the root relative to the
> appBase, not the docBase.

Which is exactly what it's supposed to do.  A docBase of "." is never,
never correct.  As others have pointed out, you should stop trying to
force use of the old deployment mechanism, and use the current, more
robust one.

1) Remove the <Context> element from server.xml.

2) Remove the existing webapps/ROOT directory.

3) Deploy your app in C:/wwwroot/path/ROOT.war (or C:/wwwroot/path/ROOT,
if expanded).

4) Create a META-INF/context.xml file in your webapp containing a
<Context> element with only a privileged="true" attribute (if you really
need even that).  You may alternatively place this <Context> element in
conf/Catalina/www.something.com/ROOT.xml, if desired.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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


Re: Tomcat 6 - includes broken

Posted by Pid <p...@pidster.com>.
Patrick Lee wrote:
>> The path attribute only works in server.xml. It is ignored in all
>> other cases. Also, it is not recommended to define contexts in
>> server.xml since you have to restart Tomcat to pick up any changes.
> 
> I am putting this in server.xml inside the relevant host. Not fussed
> about reloads. Mostly I serve a bunch of generated JSP's from various
> directories.
> 
> Here's the host setup:
> 
> <Host name="www.something.com." debug="0" appBase="c:/wwwroot/path/"
>       unpackWARs="true" autoDeploy="true"
>       xmlValidation="false" xmlNamespaceAware="false">
>    <Context path="" docBase="." debug="0" privileged="true"/>
> </Host>
> 
> This is what's not working. Additionally, If I do set the docBase to
> something else then it serves paths under the root relative to the
> appBase, not the docBase. If I leave it there with a . for the docBase
> then it fails on <@include as it thinks / is relative to the current
> directory and not the docBase.
> 
> Am I no longer able to configure Tomcat this way?

you're trying to configure the default webapp which is known as the ROOT 
application, and which needs to be referenced as such.

remove the 'path' and 'docBase' attributes and put your whole app in a 
folder called: c:/wwwroot/path/ROOT.

p

> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


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


Re: Tomcat 6 - includes broken

Posted by Patrick Lee <pa...@horologe.com.au>.
> The path attribute only works in server.xml. It is ignored in all
> other cases. Also, it is not recommended to define contexts in
> server.xml since you have to restart Tomcat to pick up any changes.

I am putting this in server.xml inside the relevant host. Not fussed
about reloads. Mostly I serve a bunch of generated JSP's from various
directories.

Here's the host setup:

<Host name="www.something.com." debug="0" appBase="c:/wwwroot/path/"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="." debug="0" privileged="true"/>
</Host>

This is what's not working. Additionally, If I do set the docBase to
something else then it serves paths under the root relative to the
appBase, not the docBase. If I leave it there with a . for the docBase
then it fails on <@include as it thinks / is relative to the current
directory and not the docBase.

Am I no longer able to configure Tomcat this way?

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


Re: Tomcat 6 - includes broken

Posted by Mark Thomas <ma...@apache.org>.
Patrick Lee wrote:
> Further, I am unable to set a default context effectively. Eg.
> 
> <Context path="" docBase="/default" debug="0" privileged="true"/>

The path attribute only works in server.xml. It is ignored in all
other cases. Also, it is not recommended to define contexts in
server.xml since you have to restart Tomcat to pick up any changes.

Outside of server.xml you have to:
- name your war ROOT.war
- deploy an exploded war in a directory call ROOT in your appBase
- place your WAR/exploded directory outside of your appBase and use a
context file named ROOT.xml

HTH,

Mark

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


Re: Tomcat 6 - includes broken

Posted by Patrick Lee <pa...@horologe.com.au>.
Further, I am unable to set a default context effectively. Eg.

<Context path="" docBase="/default" debug="0" privileged="true"/>

This won't serve /something/index.jsp on the site from
/default/something/index.jsp but instead from the root of the appBase
(not the content docBase). The only thing it will serve from /default
is files directly inside it.

If however I specify a different context like this:

<Context path="/mycontext" docBase="/default" debug="0" privileged="true"/>

Then I can server everything up from /mycontext without not found
errors on any includes and everything working fine. Of course, I don't
want to serve the whole site under such a path.

I'd say there's some chance I'm doing something obviously wrong here
but as I said I've had no troubles until 6.0.10.

Thanks.


On 3/5/07, Patrick Lee <pa...@horologe.com.au> wrote:
> > Do you have your host appBase set to be the same as your webapp
> > docBase? This will cause the behaviour you see here. This worked
> > (purely by accident - it was never intended to) in previous versions
> > due to a bug that has since been fixed.
>
> Actually, having changed that the problem persists.
>
> I either get a simple "not found" on the .jsp I'm trying to include or
> I get this. I'm not sure if there's any relevance here.
>
> java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
> java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> java.security.AccessController.doPrivileged(Native Method)
> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
> org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
> org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598)
> org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:142)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> This is on Windows 2000. As I said, I've had 5.5.15 running fine for some time.
>
> Any ideas?
>

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


Re: Tomcat 6 - includes broken

Posted by Patrick Lee <pa...@horologe.com.au>.
> Do you have your host appBase set to be the same as your webapp
> docBase? This will cause the behaviour you see here. This worked
> (purely by accident - it was never intended to) in previous versions
> due to a bug that has since been fixed.

Actually, having changed that the problem persists.

I either get a simple "not found" on the .jsp I'm trying to include or
I get this. I'm not sure if there's any relevance here.

java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:142)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


This is on Windows 2000. As I said, I've had 5.5.15 running fine for some time.

Any ideas?

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


Re: Tomcat 6 - includes broken

Posted by Mark Thomas <ma...@apache.org>.
Patrick Lee wrote:
> Hi,
> 
> I'm trying to upgrade from Tomcat 5.5.15 to 6.0.10. Everything seems
> to have gone fine except that most of my includes are broken.
> 
> I can do this:
> 
> <%@include file = "something.jsp" %>
> 
> But I can't do this:
> 
> <%@include file = "/path/to/something.jsp" %>
> 
> The latter gives me a status 500 and "File not found" on the include.
> 
> This is independent of the content of the file I'm trying to include.
> 
> Does anyone know what might have changed from 5.5.15 to 6.0.10 for
> htins to happen? Do I need to change some configurations?

Do you have your host appBase set to be the same as your webapp
docBase? This will cause the behaviour you see here. This worked
(purely by accident - it was never intended to) in previous versions
due to a bug that has since been fixed.

Mark

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