Static context from server.xml no longer working after upgrade to tomcat 9.0.37

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Static context from server.xml no longer working after upgrade to tomcat 9.0.37

Haddix, Linda

We are in the process of upgrading from Tomcat 8.0.36 to Tomcat 9.0.37 for the samesite cookie issue.  We found very few differences in the version except for

a context (static)  in server.xml for static content now gives a 404 in tomcat.  I have checked the logs and it is getting past apache 2.4 to tomcat.

I have tried adding crossContext=”true” to all applications including static but it did not help.

 

The only change made to server.xml is secretRequired=”false”

 

 

I have seen a number of posts where other people have the same issue but I have not found any replies to the question.

 

 

Tomcat logs

172.24.30.28 - - [07/Oct/2020:09:59:13 -0400] "GET /static/bp_images/5013678_RH.gif HTTP/1.1" 404 790

172.24.30.28 - - [07/Oct/2020:09:59:13 -0400] "GET /static/bp_images/5013682_RH.gif HTTP/1.1" 404 790

172.24.30.28 - - [07/Oct/2020:09:59:13 -0400] "GET /static/bp_images/5013936_RH.gif HTTP/1.1" 404 790

 

 

From server.xml

 

     <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="false" deployOnStartUp="true" >

                                <Context docBase="i:/" path="/static" />

                                <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

                                              prefix="localhost_access_log" suffix=".txt"

                              pattern="%h %l %u %t &quot;%r&quot; %s %b" />

</Host>

 

 

 

 

 

 

 

 

 

 

 

Linda Haddix

Senior Developer

Blue Bird Corporation

3920 Arkwright Road, Suite 200, Macon, GA 31210

Phone 478.822.2327 | Cell 478.737.8567

[hidden email]

 

 

 


This e-mail transmission, including any attachments, contains information of Blue Bird Corporation and may be confidential, proprietary, copyrighted and/or legally privileged. This electronic transmission is for the sole and exclusive use of the named individual or entity to which it is directed and may not be transmitted to or received by anyone other than the named addressee (or a person authorized to deliver it to the named addressee). Access to this email by anyone else is unauthorized. If you are not an intended recipient, you must not read, use, or disseminate the information contained in the email. If you have received this message in error, please immediately return this by e-mail and delete it. Any views expressed in this transmission are those of the individual sender and not the Company, unless the sender is an authorized agent of Blue Bird Corporation and is expressly speaking on its behalf.   ­­  
Reply | Threaded
Open this post in threaded view
|

Re: Static context from server.xml no longer working after upgrade to tomcat 9.0.37

Christopher Schultz-2
Linda,

On 10/7/20 10:36, Haddix, Linda wrote:

> We are in the process of upgrading from Tomcat 8.0.36 to Tomcat 9.0.37
> for the samesite cookie issue.  We found very few differences in the
> version except for
>
> a context (static)  in server.xml for static content now gives a 404 in
> tomcat.  I have checked the logs and it is getting past apache 2.4 to
> tomcat.
>
> I have tried adding crossContext=”true” to all applications including
> static but it did not help.

You shouldn't need crossContext="true" unless your application includes
code like this:

  req.getRequestDispatcher("/otherapp/resource").forward(req,rsp);

> The only change made to server.xml is secretRequired=”false”

This should not affect anything about the context deployments, etc.

> I have seen a number of posts where other people have the same issue but
> I have not found any replies to the question.

I don't recall any such questions. References?

> Tomcat logs
>
> 172.24.30.28 - - [07/Oct/2020:09:59:13 -0400] "GET
> /static/bp_images/5013678_RH.gif HTTP/1.1" 404 790
>
> 172.24.30.28 - - [07/Oct/2020:09:59:13 -0400] "GET
> /static/bp_images/5013682_RH.gif HTTP/1.1" 404 790
>
> 172.24.30.28 - - [07/Oct/2020:09:59:13 -0400] "GET
> /static/bp_images/5013936_RH.gif HTTP/1.1" 404 790

What does "DIR I:\" show?

> From server.xml
>
>      <Host name="localhost"  appBase="webapps" unpackWARs="true"
> autoDeploy="false" deployOnStartUp="true" >
>
>                                 <Context docBase="i:/" path="/static" />

Do you have another application deployed? You may want to use
<PostResources> in the application instead of a whole extra <Context>
just for this static content. It will be more flexible in the long run.

How are you launching Tomcat? Are you using a Windows Service or are you
running bin\startup.bat or similar?

If you are using the Windows Service, you should check the effective
service user and the permissions for I:\

This item appears in the changelog for Tomcat 9.0.23 (and 8.5.44):

"
Update: 63310: Update to Commons Daemon 1.2.0. This provides improved
support for Java 11. This also changes the user configured by the
Windows installer for the Windows service from Local System to the lower
privileged Local Service. (markt)
"

This item is unfortunately not present in the Migration Guide(s), but
probably should be.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]