Reputation: 39
I have created a Dynamic Web Projects named "test" using Eclipse WTP Tomcat, Eclipse version is Java EE Kepler Service Release 2, Tomcat version is 7.0.53, Servlet 3.0, Win 8.1 x86, jdk 1.6.0_45, but after several tries, I found the problem occurs when matching all the following conditions:
Here is part of <CATALINA_HOME>\conf\server.xml:
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
<Context docBase="D:/tmpdev/apache-tomcat-7.0.53/wtpwebapps/test" path="/test" reloadable="true"/>
</Host>
and here is the Directory Structure of "test":
test
├─META-INF
│ MANIFEST.MF
│
└─WEB-INF
│ web.xml
│
├─classes
│ └─test
│ HelloServlet.class
│ MyFilter1.class
│ MyFilter2.class
│ MyHttpSessionListener.class
│ MyServletContextListener.class
│
└─lib
Although WEB-INF/web.xml is <WatchedResource> in <CATALINA_HOME>\conf\context.xml by default, I tried to add a <WatchedResource> element in each of the following formats, still not works:
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF\web.xml</WatchedResource>
<WatchedResource>D:/tmpdev/apache-tomcat-7.0.53/wtpwebapps/test/WEB-INF/web.xml</WatchedResource>
<WatchedResource>D:\tmpdev\apache-tomcat-7.0.53\wtpwebapps\test\WEB-INF\web.xml</WatchedResource>
HERE is other configuration ways that works:
Upvotes: 3
Views: 11592
Reputation: 1
You have to set reloadable="true" privileged="true" in context.xml. Restart Tomcat Server and that is all.
Upvotes: 0
Reputation: 11
Reload worked only after I updated the server.xml file!!!
By setting the autoDeploy=true
<br>
The output from the logs then showed a "Reloading context"
08-May-2018 20:58:56.654 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.reload <b>Reloading context </b>[/prototype_maven]
08-May-2018 20:58:56.654 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.StandardContext.reload Reloading Context with name [/prototype_maven] has started
08-May-2018 20:58:58.619 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
08-May-2018 20:58:58.629 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.StandardContext.reload Reloading Context with name [/prototype_maven] is completed
Upvotes: -2
Reputation: 16615
<WatchedResoucre>
only works with the automatic deployment feature which is not used when Contexts are deployed from server.xml.
Upvotes: 5