struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Le Berre (JIRA)" <>
Subject [jira] [Created] (WW-4984) Static files like css and js files in struts-core not properly served
Date Tue, 20 Nov 2018 22:58:00 GMT
Daniel Le Berre created WW-4984:

             Summary: Static files like css and js files in struts-core not properly served
                 Key: WW-4984
             Project: Struts 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.5.18
            Reporter: Daniel Le Berre

While preparing a small demo of struts2 for my students I was annoyed that error messages
were not shown in red.

While investigating why, I noticed a lot of errors like this in the console:
GRAVE: "Servlet.service()" pour la servlet [default] a généré une exception
at org.apache.struts2.dispatcher.DefaultStaticContentLoader.findStaticResource(
at org.apache.struts2.dispatcher.ExecuteOperations.executeStaticResourceRequest(
at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.service(
at org.apache.coyote.AbstractProcessorLight.process(
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.base/java.util.concurrent.ThreadPoolExecutor$
at org.apache.tomcat.util.threads.TaskThread$
at java.base/


While looking at the HTML source of the page and web inspector of my browser, I also noted
that three ressources were not found in that page:



AFAIK, those resources should be served by default from struts-core jar file because 
<constant name="struts.serve.static" value="true" />{code}
by default.

I could check that setting that constant to false prevents the NPE to occur.

I was able to find the three files in struts-core jar file.

I could check that copying those files in my webapp with the constant to false fixed my css
issue regarding error messages.

So the NPE is related IMHO to  DefaultStaticContentLoader not being able to locate correctly
the resources in the jar. I do not know why.

This message was sent by Atlassian JIRA

View raw message