Problem solved in server.xml.
<Host name="example.org" appBase="/mnt/fooapps/sptomcat/foopro">
<Context debug="0" docBase="/mnt/fooapps/sptomcat/foopro" path="/" 
reloadable="true"></Context>
</Host>
It was a misconfiguration. A developer found an old server.xml in the mailbox, 
which revealed the problem.
AppBase and DocBase should not be equal. They should look like this:
appBase="/mnt/fooapps/sptomcat"
docBase="/mnt/fooapps/sptomcat/foopro"

Lesson learned: Make a backup of your configuration files.

Thanx for looking into it.

best regards


________________________________
From: Hans Schou <ha...@miracle42.dk>
Sent: Monday, May 17, 2021 12:33
To: users@tomcat.apache.org <users@tomcat.apache.org>
Subject: Re: [EXT] Re: JSP file not found in parent directory


The normalises to:
"https://example.org/am_databaseopen.jsp";


Yes, and that URL is working (I don't get a 404 page not found)

Assuming that
"https://example.org/interfaceparts/mainframenotlogged.jsp";
is located at
"$CATALINA_HOME/webapps/interfaceparts/mainframenotlogged.jsp"


Well the setup is not made with war-files and I don't know why. (I'm just here 
to fix the problem)

The server has only one Tomcat instance running and it is serving several 
virtual hosts.
In server.xml the setup is like:

<Host name="example.org" appBase="/mnt/fooapps/sptomcat/foopro">
  <Context debug="0" docBase="/mnt/fooapps/sptomcat/foopro" path="/" 
reloadable="true"></Context>
</Host>

It is not the way I normally do it. I prefer war-files in /webapps/.

The file mentioned before is here:
/mnt/fooapps/sptomcat/foopro/am_databaseopen.jsp​

When I got to the server another guy had tried with Tomcat 8.5, so now I have 
tried with 8.0 as it has less security issues but it did not change anything.


best regards
________________________________
From: Mark Thomas <ma...@apache.org>
Sent: Monday, May 17, 2021 09:13
To: users@tomcat.apache.org <users@tomcat.apache.org>
Subject: [EXT] Re: JSP file not found in parent directory

On 17/05/2021 06:24, Hans Schou wrote:
> Hi
>
> I got this error when accessing my site:
>
> org.apache.jasper.JasperException: /mainframenotlogged.jsp (line: [1], 
> column: [2]) JSP file [../am_databaseopen.jsp] not found
>
> The URL I'm accssing is like
> https://example.org/interfaceparts/mainframenotlogged.jsp
> and when I go into the directory with a console and list the file 
> ../am_databaseopen.jsp it is there.

"../am_databaseopen.jsp" is a relative URL.

It is relative to
"https://example.org/interfaceparts/mainframenotlogged.jsp";

So the absolute URL is:
"https://example.org/interfaceparts/../am_databaseopen.jsp";

The normalises to:
"https://example.org/am_databaseopen.jsp";

Assuming that
"https://example.org/interfaceparts/mainframenotlogged.jsp";
is located at
"$CATALINA_HOME/webapps/interfaceparts/mainframenotlogged.jsp"

then
"https://example.org/am_databaseopen.jsp";
will be located at:
"$CATALINA_HOME/webapps/ROOT/am_databaseopen.jsp"

Note the addition of ROOT.

$CATALINA_HOME/webapps is not equivalent to httpd's document ROOT. Each
webapp application has a context path and is located in a directory/WAR
in $CATALINA_HOME/webapps. The mapping of those directory/WAR names to
context paths is described in:
http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Naming

Note the special case for the root web application with context path "".

Mark

>
> I then tried to make a symlink to ../am_databaseopen.jsp in the sub-directory 
> and changed the file mainframenotlogged.jsp to use that but it gave the same 
> error (but pointing to a file ind the same directory).
>
> I have gone through permissions and all files are owned by user "tomcat" so 
> that should not be the problem.
>
> The server did chrashed and som configuration got lost and there is no 
> backup.  A new site with Tomcat 8.5.66 has been setup.
>
> Any help much appriciated.
>
>
> bets regards
> Hans
>


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

Reply via email to