1
votes

I've just unpacked and configured Tomcat 8.0.3 on Windows 7 with a virtual host. I've tested it successfully under the default webapps, however, my virtual host is not recognizing changes in JSP files or classes.

Here is my set up:

%CATALINA_HOME%\conf\server.xml

...
    <Engine name="Catalina" defaultHost="localhost">
    ...
      <Host name="ww.virtual.com"  appBase="vapps" unpackWARs="true" autoDeploy="true">
      </Host>
    </Engine>
... 

%SystemRoot%\system32\drivers\etc\hosts

...
127.0.0.1 ww.virtual.com

%CATALINA_HOME%\vapps\ROOT\META-INF\context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="true" privileged="true" reloadable="true">

<Resource name="jdbc/INVENTORY" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="sqlusr" password="secret1" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
               url="jdbc:sqlserver://127.0.0.1:1433;instanceName=SQLSERVER;DatabaseName=INVENTORY"/>
</Context>

%CATALINA_HOME%\vapps\ROOT\WEB-INF\web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1"
  metadata-complete="true">

  <display-name>Test Display</display-name>
  <description>Test Description</description>
  <resource-ref>
      <description>Test DB Connection</description>
      <res-ref-name>jdbc/INVENTORY</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
</web-app>

I then have JSP files located in %CATALINA_HOME%\vapps\ROOT\ and classes in %CATALINA_HOME%\vapps\ROOT\WEB-INF\classes\MainPackage\ which are properly loaded when the server is started. But if I make any changes to the JSPs or .class files, the server does not recognize the update. What am I doing wrong?

1

1 Answers

1
votes

This is happening because you have enabled anti-resource locking. With that option enable the web application is not deployed from the appBase but from a copy in the work directory. If you edit the copy in the work directory you'll see the changes.

Alternatively, remove the anti-resource locking options and fix whatever bug caused you to need them in the first place.