Greetings Users,

is it possible to use two completely separate virtual hosts
with tomcat ?
What I want to do is using two virtual hosts on the same box.
One for real web serving and one for development.

My problems so far are:
1. Class loading -
        Can I configure tomcat in a way that classes don't
        interfere between virtual hosts ?
2. Context scope -
        Can I use JkMount with a single path for all
        applications ?
3. Host aliases
        Can I do an 'AutoWebApp' for an 'Alias' and
        a full host name at the same time ?

Please note, that:
        The application name is 'jRolodex', but I used the 'numguess.jsp'
        example for testing.
        'www' is the web host and
        'javadex' is the development host.

        A 'build.sh all' copies the application files to host 'javadex'
        i.e. the 'docBase' directory of virtual host
        'javadex.tiade-voboe.de'.

        A 'build.sh dist' produces a 'jRolodex.war' and a 'jRoldex.jar'
        in the 'docBase' directory of host 'www.tiade-voboe.de'.

Before I plunge into the details, please look at the partial
config files, stack and SW version at the end of this mail.

Now the gory details:

ad 1.  When i change some code in the application and afterwards do a
        'build.sh all' for application 'jRolodex' without doing a
        'build.sh dist', the first virtual server I hit works fine!
        No matter wether it is 'www' or 'javadex'.
        The second server always gets an 'Error 500' (see error stack at
        end of mail).
        It seems to me, that tomcat does not load the appropriate class
        definitions.

ad 2.  I tried to use '/wapps' as the context path (with and without a
        'prefix' in 'AutoWebApp') because I wanted something like
        'JkMount /wapps' in 'httpd.conf'. It didn't work. So I have 
        to mount every application explicitly.

ad 3.  I tried to use the 'Alias' definition in 'AutoWebApp'. I.e.:
        <AutoWebApp dir="/usr/local/httpd/webapps/javadex"
                prefix="/wapps" 
                host="javadex" />
        It worked fine but it didn't work for 'javadex.tiade-voboe.de' (and
        vice versa).


<!-- --------------- httpd.conf START ---------------------------------- -->
# ----- The Waltons, Daltons, everyone
<VirtualHost www.tiade-voboe.de:80>
    ServerAdmin [EMAIL PROTECTED]
    ServerName  www.tiade-voboe.de
    DocumentRoot "/usr/local/httpd/htdocs/www"
    ServerAlias www       www.tiade-voboe.de
  
    <Directory "/usr/local/httpd/htdocs/www" >
        Options Indexes -FollowSymLinks -Includes +MultiViews
        Order deny,allow
        Allow from all
    </Directory>

    JkMount /*.jsp ajp13
    JkMount /wapps/jRolodex ajp13
    JkMount /wapps/jRolodex/* ajp13
</VirtualHost>

# ----- Tomcat developer
<VirtualHost javadex.tiade-voboe.de:80>
    ServerAdmin [EMAIL PROTECTED]
    ServerName javadex.tiade-voboe.de
    DocumentRoot "/usr/local/httpd/htdocs/javadex"
    ServerAlias javadex   javadex.tiade-voboe.de

    # ----- Here comes the directory accessible by all users of the local 
network
    <Directory "/usr/local/httpd/htdocs/javadex" >
        Options Indexes +FollowSymLinks -Includes +MultiViews
        Order allow,deny
        Allow from 192.168.17.0/255.255.255.0
    </Directory>

    JkMount /*.jsp ajp13
    JkMount /wapps/jRolodex ajp13
    JkMount /wapps/jRolodex/* ajp13
</VirtualHost>
<!-- --------------- httpd.conf END ------------------------------------ -->

<!-- --------------- apps-vhosts.xml START ----------------------------- -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<Server>


    <Host name="www.tiade-voboe.de">
        <Alias name="www" />
        <Context path=""
            docBase="/usr/local/httpd/webapps/www" 
            debug="0"
            reloadable="False" > 
              <SimpleRealm filename="conf/users/example-users.xml" />
              <LogSetter name="www_tc.log" 
                        path="/var/log/tomcat/www_tc.log"
                        verbosityLevel="ERROR"/>
              <LogSetter name="www_servlet_log"
                        path="/var/log/tomcat/www_servlet.log" 
                        servletLogger="true"
                        verbosityLevel = "ERROR"/>
        <AutoDeploy source="/usr/local/httpd/webapps/www"
                target="/usr/local/httpd/webapps/www" />
        <AutoWebApp dir="/usr/local/httpd/webapps/www"
                prefix="/wapps" 
                host="www.tiade-voboe.de" />
        </Context>
    </Host>


    <Host name="javadex.tiade-voboe.de">
        <Alias name="javadex" />
        <Context path="" 
            docBase="/usr/local/httpd/webapps/javadex"
            debug="99" 
            reloadable="True"
              <SimpleRealm filename="conf/users/example-users.xml" />
              <LogSetter name="javadex_tc.log"
                        path="/var/log/tomcat/javadex_tc.log" 
                        verbosityLevel = "DEBUG"/>
              <LogSetter name="javadex_servlet_log" 
                        path="/var/log/tomcat/javadex_servlet.log"
                        servletLogger="DEBUG"/>
        <AutoWebApp dir="/usr/local/httpd/webapps/javadex"
                prefix="/wapps" 
                host="javadex.tiade-voboe.de" />
        </Context>
    </Host>


</Server>

<!-- --------------- apps-vhosts.xml END ------------------------------- -->


<!-- --------------- Error stack START - ------------------------------- -->
Error: 500Location: /wapps/jRolodex/numguess.jspInternal Servlet Error:
org.apache.jasper.JasperException: object is not an instance of declaring 
class
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(Unknown Source)
        at org.apache.jasper.runtime.JspRuntimeLibrary.introspect(Unknown 
Source)
        at numguess_1._jspService(numguess_1.java:84)
        at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
        at org.apache.tomcat.core.Handler.invoke(Unknown Source)
        at org.apache.tomcat.core.Handler.service(Unknown Source)
        at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
        at org.apache.tomcat.core.ContextManager.internalService(Unknown 
Source)
        at org.apache.tomcat.core.ContextManager.service(Unknown Source)
        at 
org.apache.tomcat.modules.server.Ajp13Interceptor.processConnection(Unknown 
Source)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:539)
Root cause:
java.lang.IllegalArgumentException: object is not an instance of declaring 
class
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:42)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:28)
        at java.lang.reflect.Method.invoke(Method.java:327)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(Unknown Source)
        at org.apache.jasper.runtime.JspRuntimeLibrary.introspect(Unknown 
Source)
        at numguess_1._jspService(numguess_1.java:84)
        at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
        at org.apache.tomcat.core.Handler.invoke(Unknown Source)
        at org.apache.tomcat.core.Handler.service(Unknown Source)
        at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
        at org.apache.tomcat.core.ContextManager.internalService(Unknown 
Source)
        at org.apache.tomcat.core.ContextManager.service(Unknown Source)
        at 
org.apache.tomcat.modules.server.Ajp13Interceptor.processConnection(Unknown 
Source)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:539)
<!-- --------------- Error stack END------------------------------- -->


<!-- --------------- Software versions START ---------------------- -->
<!-- ---- Server side -->
srv01:~ # uname -a
Linux srv01.tiade-voboe.de 2.4.16 #38 SMP Fri Dec 28 20:37:27 CET 2001 i686 
unknown
srv01:~ # java -version
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
srv01:~ # file /usr/local/httpd/tomcat
/usr/local/httpd/tomcat: symbolic link to jakarta-tomcat-3.3

<!-- ---- Client side -->
martin@maptop:~ > java -version
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
martin@maptop:~ >konqueror --version
Qt: 2.3.0
KDE: 2.1.2
Konqueror: 2.1.1
<!-- --------------- Software versions END ------------------------ -->

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to