Hi, First of all I just want to say that this issue has been dragging me for the last 3 days and I've had it up to here. You have to excuse my sophomoric knowledge of Tomcat as I've just started learning servlet and thought Tomcat would be a suitable container for a novice. Sorry for posting such a long post...
I have an issue with autodeployment of my context. Before I explaing my problem, allow me to give the specificaitons of the products I am utilizing: OS: Linux (Slackware) 2.6.14 Tomcat: 5.5.16 Apache Webserver: 2.0.54 jk_mod: 1.2.15 JDK: 1.5.04 I am trying to setup a virtualhost that would deploy a web application with Apacha webserver, jk_mod as a connector, and Tomcat as a servlet engine. Everything has been set up properly and I can deploy my web application just fine. The issue rises when I try to modify `WEB-INF/web.xml' (for example changing the url-mapping) but the changes would not take effect despite the fact it (web.xml) is under WatchResource monitoring. However, I "can" compile an existing class and dump it in WEB-INF/classes/ and have the server autodeploys it without restarting the actual server. But again, "ANY" classes that does not have "url mapping" in WEB-INF/web.xml, would not be autodeployed even if Tomcat server is restarted. So once again, any class that has an existing url-mapping in WEB-INF/web.xml, can be recompiled and autodeployed upon placement in WEB-INF/classes but no newly compiled class that does not have url-mapping in web.xml can be autodeployed or deployed at all (or at least I get status 404 when I point my browser to the servlet). Anyway, here are the content of my Apache virtualhost/jk_mod, Tomcat's conf/server.xml, web application's WEB-INF/web.xml, and the actual layout of what is placed where. ############# apache2/conf/httpd.conf ############# JkWorkersFile "/usr/local/apache2/conf/workers.properties" JkLogFile "/usr/local/apache2/logs/mod_jk.log" JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" <VirtualHost 192.168.1.155:80> ServerAdmin [EMAIL PROTECTED] ServerName vh.domain.com DocumentRoot /var/webapps/vh/demo ErrorLog /var/webapps/vh/logs/error_log CustomLog /var/webapps/vh/logs/access_log common JkMount /*.jsp wrkr JkMount /* wrkr # JkMount /servlet/* wrkr # I have tried /otherdirs as well # Deny direct access to WEB-INF <LocationMatch ".*WEB-INF.*"> AllowOverride None deny from all </LocationMatch> </VirtualHost> ############# Tomcat's conf/server.xml ############## <Server port="8005" shutdown="fb4b737d65518b1beeffc9f70c212e51d7e13"> <Service name="Tomcat-Apache"> <Connector address="127.0.0.1" port="8009" minProcessors="5" maxProcessors="75" enableLookups="false" protocol="AJP/1.3"/> <Engine name="appserver" defaultHost="vh.domain.com"> <Host name="vh.doman.com" appBase="/var/webapps/vh/demo" autoDeploy="true" deployOnStartup="true" upackWARs="false" deployXML="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="vh_access_log." suffix=".txt" pattern="common" resolveHosts="true"/> <Context path="" docBase="" reloadable="true"> <WatchedResource>WEB-INF/web.xml</WatchedResource> </Context> </Host> </Engine> </Service> </Server> Regarding conf/server.xml... I have tried to set `appBase' to /var/webapps and use a relative path with respect to it for my `docBase' to set it to `vh/demo' or `appBase="/var/webapps/vh"' and `docBase="demo" and ALL the combinations "WORK." So I don't have any problem as far as running the servlet or having *.jsp getting compiled and all that. But one thing that I haven't been to get to work is to apply the recommendation given for 5.5 to place the `Context' element outside of the `conf/server.xml'. That is to place <Context ... > in `conf/$engine/$host/context.xml.default (or context.xml OR demo.xml) `conf/appserver/vh.domain.com/context.xml.default' OR `conf/appserver/vh.domain.com/context.xml' OR `conf/appserver/vh.domain.com/demo.xml' None of such settings would allow the execution of my servlets. With having <Context ...> in its own directory and the same settings. When I point my browser to the designated servlet URI, I get a blank page. As soon as I put <Context> back to conf/server.xml, everything works as before and for the life of me I cannot figure out why. Despite of the fact logs/catalina.out reports of processing the context from those locations... I have even changed the Engine name to `Catalina' with no luck. Tomcat does indeed, as you can see in the logging below, that looks for the context in `conf/$engine/$host/context.xml.default' but as I have mentioned, if context is taken out of conf/server.xml to that location, nothing will work as oppose to autodeploment issue of web.xml. I have also taken WatchedResource out of the context with no luck. I have read that placing context of Host in conf/server.xml would only allow it to be "read" at the start up and at no other time this re-read is being performed. Is that true? If so, then why can't I get the recommended version to work!!! Even the default conf/web.xml also has WEB-INF/web.xml under monitor... (SIGH). I have even played with various attribute settings thinking maybe having multiple "deployment" schemes (i.e. autodeploy, reloadable...) would conflict for some odd reason, but it didn't help. ############## logs/catalina.out ################ ... FINE: ContextConfig: Initializing Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig processContextConfig FINE: Processing context [] configuration file /usr/local/tomcat conf/context.xml Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig processContextConfig FINE: Successfully processed context [] configuration file /usr/local/tomcat conf/context.xml Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig processContextConfig FINE: Processing context [] configuration file /usr/local/tomcat/conf appserver/vh.domain.com/context.xml.default Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig start FINE: ContextConfig: Processing START Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig processDefaultWebConfig FINE: Processing context [] web configuration resource file:///usr/local/tomcat/conf/web.xml Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig applicationWebConfig FINE: Parsing application web.xml file at jndi:/vh.domain.com/WEB-INF/web.xml Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig start FINE: Pipeline Configuration: Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig start FINE: org.apache.catalina.core.StandardContextValve/1.0 Apr 15, 2006 5:24:25 PM org.apache.catalina.startup.ContextConfig start FINE: ====================== Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig init FINE: ContextConfig: Initializing Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig processContextConfig FINE: Processing context [/jsp] configuration file /usr/local/tomcat conf/context.xml Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig processContextConfig FINE: Successfully processed context [/jsp] configuration file /usr/local/tomcat conf/context.xml Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig processContextConfig FINE: Processing context [/jsp] configuration file /usr/local/tomcat/conf appserver/vh.domain.com/context.xml.default Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig processContextConfig FINE: Processing context [/jsp] configuration file /var/webapps/vh/demo/jsp/META-INF/context.xml null Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig start FINE: ContextConfig: Processing START Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig processDefaultWebConfig FINE: Processing context [/jsp] web configuration resource file:///usr/local/tomcat/conf/web.xml Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig applicationWebConfig FINE: Missing application web.xml, using defaults only StandardEngine[appserver].StandardHost[vh.domain.com].StandardContext[/jsp] Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig start FINE: Pipeline Configuration: Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig start FINE: org.apache.catalina.core.StandardContextValve/1.0 Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig start .... Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig start FINE: Pipeline Configuration: Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig start FINE: org.apache.catalina.core.StandardContextValve/1.0 Apr 15, 2006 5:24:26 PM org.apache.catalina.startup.ContextConfig start FINE: ====================== Apr 15, 2006 5:24:27 PM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /127.0.0.1:8009 Apr 15, 2006 5:24:27 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/165 config=null Apr 15, 2006 5:24:27 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 2136 ms ############# Layout of web application ################ /var/webapps/vh/demo /var/webapps/vh/demo/SomeHtml.html /var/webapps/vh/demo/WEB-INF /var/webapps/vh/demo/WEB-INF/web.xml /var/webapps/vh/demo/WEB-INF/classes /var/webapps/vh/demo/WEB-INF/classes/OldServer /var/webapps/vh/demo/WEB-INF/classes/MyClass /var/webapps/vh/demo/jsp /var/webapps/vh/demo/jsp/Expression.jsp /var/webapps/vh/demo/jsp/Hello.jsp I don't have this problem with *.jsp of course, as they are compiled and loaded into memory (I do find them in work/$host/_/...). ############# WEB-INF/web.xml ################ <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>my new servlet</servlet-name> <servlet-class>MyClass</servlet-class> </servlet> <servlet> <servlet-name>my old servlet</servlet-name> <servlet-class>OldServer</servlet-class> </servlet> <servlet-mapping> <servlet-name>my new servlet</servlet-name> <url-pattern>/hello/welcome/myclass</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>my old servlet</servlet-name> <url-pattern>/goodbye/os</url-pattern> </servlet-mapping> </web-app> As you can see, once the tomcat is started (or restarted), having this descriptor in place, I can access all the servlets accordingly: http://vh.domain.com/hello/welcome/myclass http://vh.domain.com/goodbye/os Now, if I modify web.xml to point at a different mapping, i.e. ... <servlet-mapping> <servlet-name>my old servlet</servlet-name> <url-pattern>/newmapping/os</url-pattern> </servlet-mapping> ... http://vh.domain.com/newmapping/os would NOT work and I get status 404 from the server but the old one still reponses (in memory still?): http://vh.domain.com/goodbye/os (OK) (According to tomcat/logs/vh_access_logs.{date}.txt) Now, if I replace WEB-INF/classes/OldServer.class with the modified and compiled version, I "can" see the changes "without" being have to restart Tomcat. So for some reason, autodeployment works for the classes that already have "url mapping" in place in web.xml!!! But if I place a new class (WEB-INF/classes/SomeNewClass.class) and even if it has <servlet> in web.xml but NOT <servlet-mapping>, it WILL NOT autodeploy it. http://vh.domain.com/SomeNewClass (or /servlet/SomeNewClass). I even tried to put `SomeNewClass' in a package but still no effect: WEB-INF/classes/packging/is/fun/SomeNewClass http://vh.domain.com/packging.is.fun.SomeNewClass "WHY! WHY! WHY!" I even tried to place the entire web application under tomcat/webapps with various settings forementioned but the problem still persists. I've monitored the creation of tomcat processes at the startup and shutdown to make sure I am not dealing with the old ones, but everything looks good. The permissions for all directories and files are also monitored and they all appear correct. One last thing to mention is that tomcat is run by a newly created unix user (`tomcat' in this case). A group also with the same name, `tomcat' is also created which would allow multiple developers beloging to this group to have access to the web application env. during the development (or theoratically speaking). What could possibly be the problem, Java, Tomcat, jk_mod, Apache webserver??? Anyone got any idea as I have exhausted all the available options? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]