0 Replies Latest reply on Jul 9, 2004 4:33 AM by Deniz Tatar

    Virtual host problem (Tomcat can't find default web.xml and

    Deniz Tatar Newbie

      Hi all,

      I downloaded and installed JBoss version 3.2.5 without any problem.
      When I started JBoss it works fine. No errors in logs.

      I have an web application (war) which already running on a standalone Tomcat 5.0.26 (different machine).

      I copied this web app to Jboss "deploy" folder as "mywebapp.war". After copy application initialized and deployed automatically without any problem.

      But I must use this web app under different host. So I configured this web application to JBoss with a different host configuration.

      I added a virtual host configuration and a context for this web app. like this;

      <Host name="mrsea.test.com">
       <Alias>mrsea</Alias>
       <Valve className="org.apache.catalina.valves.AccessLogValve"
       prefix="mrsea.test.com_access_log." suffix=".txt" pattern="common"
       directory="${jboss.server.home.dir}/log"/>
       <Logger className="org.apache.catalina.logger.FileLogger"
       prefix="mrsea.test.com_log." suffix=".txt"
       directory="${jboss.server.home.dir}/log" timestamp="true"/>
       <Valve className="org.jboss.web.tomcat.security.SecurityAssociationValve"/>
       <!-- Default context parameters -->
       <DefaultContext cookies="true" crossContext="true" override="true"/>
      
       <Context path="/mywebapp" docBase="E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp"
       debug="0" reloadable="true" cookies="false">
       </Context>
       </Host>


      After restart I saw following messages ;

      2004-07-09 09:55:03,831 INFO [org.apache.catalina.core.StandardEngine] Starting Servlet Engine: Apache Tomcat/5.0.26
      2004-07-09 09:55:03,841 INFO [org.apache.catalina.core.StandardHost] XML validation disabled
      2004-07-09 09:55:03,871 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Starting tomcat.mrsea.test.com./mywebapp.Context
      2004-07-09 09:55:03,871 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Registering j2eeType=WebModule,name=//mrsea.test.com/mywebapp,J2EEApplication=none,J2EEServer=none for null
      2004-07-09 09:55:03,881 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Configuring default Resources
      2004-07-09 09:55:03,951 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] No realm for this host jboss.web:type=Host,host=mrsea.test.com,path=/mywebapp
      2004-07-09 09:55:03,951 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Configuring non-privileged default Loader
      2004-07-09 09:55:04,142 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Processing standard container startup
      2004-07-09 09:55:04,182 INFO [org.apache.catalina.loader.WebappLoader] Dual registration of jndi stream handler: factory already defined
      2004-07-09 09:55:04,622 INFO [org.apache.catalina.startup.ContextConfig] No default web.xml
      2004-07-09 09:55:04,652 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
      2004-07-09 09:55:04,752 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Posting standard context attributes
      2004-07-09 09:55:04,752 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Configuring application event listeners
      2004-07-09 09:55:04,752 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Configuring event listener class 'mywebapp.DTServletContextListener'
      2004-07-09 09:55:04,802 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Sending application start events
      2004-07-09 09:55:05,544 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Starting filters
      2004-07-09 09:55:05,574 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Starting completed
      2004-07-09 09:55:05,574 DEBUG [tomcat.mrsea.test.com./mywebapp.Context] Checking for jboss.web:j2eeType=WebModule,name=//mrsea.test.com/mywebapp,J2EEApplication=none,J2EEServer=none
      2004-07-09 09:55:05,634 INFO [org.apache.catalina.core.StandardHost] Create Host deployer for direct deployment ( non-jmx )
      2004-07-09 09:55:05,644 INFO [org.apache.catalina.core.StandardHost] XML validation disabled
      2004-07-09 09:55:05,654 INFO [org.apache.catalina.startup.Catalina] Server startup in 1833 ms


      There is a message like;

      2004-07-09 09:55:04,622 INFO [org.apache.catalina.startup.ContextConfig] No default web.xml

      So I think tomcat could not find default web.xml file if you define a different host other than localhost.
      Default web.xml is under "..\server\default\deploy\jbossweb-tomcat50.sar" folder.

      I copied this file in to "..\server\default\conf" folder and added an attribute to my context tag like this;

       <Context path="/mywebapp" docBase="E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp"
      defaultWebXml="${jboss.server.home.dir}/conf/web.xml"
       </Context path>
      


      After restart there wasn't any "no default web.xml" message.

      I tried to test my web app but when I visit my index.jsp file HTTP 500 occured with message;

      org.apache.jasper.JasperException: Unable to compile class for JSP

      package javax.servlet does not exist
      ...
      2004-07-09 10:24:25,114 ERROR [org.apache.jasper.compiler.Compiler] Env: Compile: javaFileName=/C:/jboss-3.2.5/server/default/work/jboss.web/mrsea.test.com/mywebapp//org/apache/jsp\index_jsp.java
      classpath=/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/classes/;/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/lib/ok.jar;/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/lib/jstl.jar;/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/lib/standard.jar;C:\jboss-3.2.5\server\default\work\jboss.web\mrsea.test.com\mywebapp;/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/classes/;/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/lib/ok.jar;/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/lib/jstl.jar;/E:/Java/Projects/WebApplications/MyWebappProject/webroot/doc/rootwebapp/WEB-INF/lib/standard.jar;/C:/j2sdk1.4.2_05/lib/tools.jar;/C:/jboss-3.2.5/bin/run.jar;/C:/j2sdk1.4.2_05/jre/lib/ext/dnsns.jar;/C:/j2sdk1.4.2_05/jre/lib/ext/ldapsec.jar;/C:/j2sdk1.4.2_05/jre/lib/ext/localedata.jar;/C:/j2sdk1.4.2_05/jre/lib/ext/sunjce_provider.jar
      cp=C:\j2sdk1.4.2_05\lib\tools.jar;C:\jboss-3.2.5\bin\\run.jar
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\classes
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\lib\ok.jar
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\lib\jstl.jar
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\lib\standard.jar
      cp=C:\jboss-3.2.5\server\default\work\jboss.web\mrsea.test.com\mywebapp
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\classes
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\lib\ok.jar
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\lib\jstl.jar
      cp=E:\Java\Projects\WebApplications\MyWebappProject\webroot\doc\rootwebapp\WEB-INF\lib\standard.jar
      cp=C:\j2sdk1.4.2_05\lib\tools.jar
      cp=C:\jboss-3.2.5\bin\run.jar
      cp=C:\j2sdk1.4.2_05\jre\lib\ext\dnsns.jar
      cp=C:\j2sdk1.4.2_05\jre\lib\ext\ldapsec.jar
      cp=C:\j2sdk1.4.2_05\jre\lib\ext\localedata.jar
      cp=C:\j2sdk1.4.2_05\jre\lib\ext\sunjce_provider.jar
      work dir=C:\jboss-3.2.5\server\default\work\jboss.web\mrsea.test.com\mywebapp
      extension dir=C:\j2sdk1.4.2_05\jre\lib\ext
      srcDir=C:\jboss-3.2.5\server\default\work\jboss.web\mrsea.test.com\mywebapp
      include=org/apache/jsp/index_jsp.java

      I think that tomcat jsp compiler can't find servlet-api.jar, jsp-api.jar and other jar files under /WEB-INF/lib folder of application if you try to configure a virtual host with a context which outside of deploy folder.

      I think these are bug and want to report;

      If you configure a virtual host with a context outside of deploy folder;

      1. Tomcat can't find default web.xml file and web application does not work,
      2. Tomcat can't find servlet-api, jsp-api and jars under WEB-INF/lib and jasper can not compile jsp pages.