RE: Apache + Tomcat Virtual Host not loading web.xml
I don't think you have a servlet mapping until you add a servlet-mapping entry to your web.xml. I could be wrong, but I don't believe the Servlet spec guarantees you can access the servlet by name with just a servlet-name. That nitpick aside, I assume you are using Tomcat 3.2.x. Neither mod_jk or mod_jserv pass web.xml information to Apache. All Apache knows about Tomcat's contexts is what it gets from the config file(s). You will need to manually add the servlet mappings you need, JkMount /setup ajp13 in your case. Tomcat 3.3 tries to support this a little better by including servlet mappings in the auto-generated config file. However, this is not the default behavior for generating the config file. Instead, the default is to map all requests related to a Tomcat context, and not have Apache serve static files. This helps insure that the behavior defined in the web.xml file functions properly. You can try by specifying JkMount / ajp13 and JkMount /* ajp13. Note that in spite of this, Apache will still serve an index.html without giving Tomcat a chance to serve the request. Hope this helps. Larry -Original Message- From: Neil Aggarwal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 05, 2001 7:49 PM To: Tomcat-User Subject: Apache + Tomcat Virtual Host not loading web.xml Hello: I am trying to set-up a virtual host on my set-up with apache and tomcat. Here is what I did: I added this to the htpd.conf file: VirtualHost [IP Address] DocumentRoot /home/myhost/public-html ServerName myhost.JAMMConsulting.com JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 Directory /home/myhost/public-html/WEB-INF deny from all Options None /Directory /VirtualHost I added the following to tomcat's server.xml: Host name=myhost.JAMMConsulting.com Context path= docBase=/home/myhost/public-html debug=0/ /Host I put the following web.xml in the directory /home/myhost/public-html/WEB-INF: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app servlet servlet-name setup /servlet-name servlet-class SetupServlet /servlet-class init-param param-nameDbName/param-name param-valuemydb/param-value /init-param init-param param-nameDbUser/param-name param-valuemyuser/param-value /init-param init-param param-nameDbPassword/param-name param-value[password]/param-value /init-param load-on-startup1/load-on-startup /servlet /web-app I restarted both apache and tomcat. The setup servlet is there to create a database pool, but it is not getting loaded. I tried putting some logging in the SetupServlet and it does not get called. I manually visited http://myhost.JAMMConsulting.com/servlet/SetupServlet and it worked fine. So, apparently the web.xml is not being loaded by the web application. Any ideas? Thanks, Neil. -- Neil Aggarwal JAMM Consulting, Inc.(972) 612-6056, http://www.JAMMConsulting.com Custom Internet DevelopmentWebsites, Ecommerce, Java, databases
RE: Apache + Tomcat Virtual Host not loading web.xml
Larry: The JkMount is in the apache httpd.conf file, but the web.xml should be read by tomcat when it starts up. Apache is not even in the picture yet. I think the problem is that tomcat is either: 1. Not processing the web.xml. 2. Not finding the setup servlet. I dont think this has anything to do with the servlet mappings of apache. Thanks, Neil. -- Neil Aggarwal JAMM Consulting, Inc.(972) 612-6056, http://www.JAMMConsulting.com Custom Internet DevelopmentWebsites, Ecommerce, Java, databases -Original Message- From: Larry Isaacs [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 06, 2001 7:48 AM To: '[EMAIL PROTECTED]' Subject: RE: Apache + Tomcat Virtual Host not loading web.xml I don't think you have a servlet mapping until you add a servlet-mapping entry to your web.xml. I could be wrong, but I don't believe the Servlet spec guarantees you can access the servlet by name with just a servlet-name. That nitpick aside, I assume you are using Tomcat 3.2.x. Neither mod_jk or mod_jserv pass web.xml information to Apache. All Apache knows about Tomcat's contexts is what it gets from the config file(s). You will need to manually add the servlet mappings you need, JkMount /setup ajp13 in your case. Tomcat 3.3 tries to support this a little better by including servlet mappings in the auto-generated config file. However, this is not the default behavior for generating the config file. Instead, the default is to map all requests related to a Tomcat context, and not have Apache serve static files. This helps insure that the behavior defined in the web.xml file functions properly. You can try by specifying JkMount / ajp13 and JkMount /* ajp13. Note that in spite of this, Apache will still serve an index.html without giving Tomcat a chance to serve the request. Hope this helps. Larry -Original Message- From: Neil Aggarwal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 05, 2001 7:49 PM To: Tomcat-User Subject: Apache + Tomcat Virtual Host not loading web.xml Hello: I am trying to set-up a virtual host on my set-up with apache and tomcat. Here is what I did: I added this to the htpd.conf file: VirtualHost [IP Address] DocumentRoot /home/myhost/public-html ServerName myhost.JAMMConsulting.com JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 Directory /home/myhost/public-html/WEB-INF deny from all Options None /Directory /VirtualHost I added the following to tomcat's server.xml: Host name=myhost.JAMMConsulting.com Context path= docBase=/home/myhost/public-html debug=0/ /Host I put the following web.xml in the directory /home/myhost/public-html/WEB-INF: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app servlet servlet-name setup /servlet-name servlet-class SetupServlet /servlet-class init-param param-nameDbName/param-name param-valuemydb/param-value /init-param init-param param-nameDbUser/param-name param-valuemyuser/param-value /init-param init-param param-nameDbPassword/param-name param-value[password]/param-value /init-param load-on-startup1/load-on-startup /servlet /web-app I restarted both apache and tomcat. The setup servlet is there to create a database pool, but it is not getting loaded. I tried putting some logging in the SetupServlet and it does not get called. I manually visited http://myhost.JAMMConsulting.com/servlet/SetupServlet and it worked fine. So, apparently the web.xml is not being loaded by the web application. Any ideas? Thanks, Neil. -- Neil Aggarwal JAMM Consulting, Inc.(972) 612-6056, http://www.JAMMConsulting.com Custom Internet DevelopmentWebsites, Ecommerce, Java, databases
RE: Apache + Tomcat Virtual Host not loading web.xml
Hi Niel, Sorry I didn't pickup that this was a load on startup problem. Cutting an pasting your settings into Tomcat 3.3's examples webapp reveals why web.xml is not being read (WebXmlReader has a validate parameter which defaults to true). A syntax error exists at: param-nameDbUser/param-name param-valuemyuser/param-value '' is missing --^ I'm assuming there was no cut and paste error placing the text into the e-mail. Larry -Original Message- From: Neil Aggarwal [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 06, 2001 1:53 PM To: [EMAIL PROTECTED] Subject: RE: Apache + Tomcat Virtual Host not loading web.xml Larry: The JkMount is in the apache httpd.conf file, but the web.xml should be read by tomcat when it starts up. Apache is not even in the picture yet. I think the problem is that tomcat is either: 1. Not processing the web.xml. 2. Not finding the setup servlet. I dont think this has anything to do with the servlet mappings of apache. Thanks, Neil. -- Neil Aggarwal JAMM Consulting, Inc.(972) 612-6056, http://www.JAMMConsulting.com Custom Internet DevelopmentWebsites, Ecommerce, Java, databases -Original Message- From: Larry Isaacs [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 06, 2001 7:48 AM To: '[EMAIL PROTECTED]' Subject: RE: Apache + Tomcat Virtual Host not loading web.xml I don't think you have a servlet mapping until you add a servlet-mapping entry to your web.xml. I could be wrong, but I don't believe the Servlet spec guarantees you can access the servlet by name with just a servlet-name. That nitpick aside, I assume you are using Tomcat 3.2.x. Neither mod_jk or mod_jserv pass web.xml information to Apache. All Apache knows about Tomcat's contexts is what it gets from the config file(s). You will need to manually add the servlet mappings you need, JkMount /setup ajp13 in your case. Tomcat 3.3 tries to support this a little better by including servlet mappings in the auto-generated config file. However, this is not the default behavior for generating the config file. Instead, the default is to map all requests related to a Tomcat context, and not have Apache serve static files. This helps insure that the behavior defined in the web.xml file functions properly. You can try by specifying JkMount / ajp13 and JkMount /* ajp13. Note that in spite of this, Apache will still serve an index.html without giving Tomcat a chance to serve the request. Hope this helps. Larry -Original Message- From: Neil Aggarwal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 05, 2001 7:49 PM To: Tomcat-User Subject: Apache + Tomcat Virtual Host not loading web.xml Hello: I am trying to set-up a virtual host on my set-up with apache and tomcat. Here is what I did: I added this to the htpd.conf file: VirtualHost [IP Address] DocumentRoot /home/myhost/public-html ServerName myhost.JAMMConsulting.com JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 Directory /home/myhost/public-html/WEB-INF deny from all Options None /Directory /VirtualHost I added the following to tomcat's server.xml: Host name=myhost.JAMMConsulting.com Context path= docBase=/home/myhost/public-html debug=0/ /Host I put the following web.xml in the directory /home/myhost/public-html/WEB-INF: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app servlet servlet-name setup /servlet-name servlet-class SetupServlet /servlet-class init-param param-nameDbName/param-name param-valuemydb/param-value /init-param init-param param-nameDbUser/param-name param-valuemyuser/param-value /init-param init-param param-nameDbPassword/param-name param-value[password]/param-value /init-param load-on-startup1/load-on-startup /servlet /web-app I restarted both apache and tomcat. The setup servlet is there to create a database pool, but it is not getting loaded. I tried putting some logging in the SetupServlet and it does not get called. I manually visited http://myhost.JAMMConsulting.com/servlet/SetupServlet and it worked fine. So, apparently the web.xml is not being loaded by the web application. Any ideas? Thanks, Neil. -- Neil Aggarwal JAMM Consulting, Inc.(972) 612-6056, http://www.JAMMConsulting.com Custom Internet DevelopmentWebsites, Ecommerce, Java
Apache + Tomcat Virtual Host not loading web.xml
Hello: I am trying to set-up a virtual host on my set-up with apache and tomcat. Here is what I did: I added this to the htpd.conf file: VirtualHost [IP Address] DocumentRoot /home/myhost/public-html ServerName myhost.JAMMConsulting.com JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 Directory /home/myhost/public-html/WEB-INF deny from all Options None /Directory /VirtualHost I added the following to tomcat's server.xml: Host name=myhost.JAMMConsulting.com Context path= docBase=/home/myhost/public-html debug=0/ /Host I put the following web.xml in the directory /home/myhost/public-html/WEB-INF: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app servlet servlet-name setup /servlet-name servlet-class SetupServlet /servlet-class init-param param-nameDbName/param-name param-valuemydb/param-value /init-param init-param param-nameDbUser/param-name param-valuemyuser/param-value /init-param init-param param-nameDbPassword/param-name param-value[password]/param-value /init-param load-on-startup1/load-on-startup /servlet /web-app I restarted both apache and tomcat. The setup servlet is there to create a database pool, but it is not getting loaded. I tried putting some logging in the SetupServlet and it does not get called. I manually visited http://myhost.JAMMConsulting.com/servlet/SetupServlet and it worked fine. So, apparently the web.xml is not being loaded by the web application. Any ideas? Thanks, Neil. -- Neil Aggarwal JAMM Consulting, Inc.(972) 612-6056, http://www.JAMMConsulting.com Custom Internet DevelopmentWebsites, Ecommerce, Java, databases