You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Martin v. Boehlen" <bo...@tiade-voboe.de> on 2002/01/08 23:04:55 UTC
class loading tc 3.3 & virtual hosts
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 technik@tiade-voboe.de
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 boehlen@tiade-voboe.de
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: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>
Re: class loading tc 3.3 & virtual hosts
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Tue, 8 Jan 2002, James Chuang wrote:
> Date: Tue, 8 Jan 2002 15:46:12 -0800
> From: James Chuang <dr...@earthlink.net>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>,
> boehlen@tiade-voboe.de
> Subject: Re: class loading tc 3.3 & virtual hosts
>
> Yes you can. You can deploy 2 separate tomcat's each with their own ports,
> contexts, etc. This will allow you to run your apps in 2 separate VMs, so
> they can use different versions of classes etc.
>
> This was in Tomcat 3.23-3.3. I think 4 should work the same way with this?
>
In Tomcat 4 stand-alone, you can run multiple virtual
hosts in the same JVM, as long as each app keeps all their classes in
their own /WEB-INF subdirectories -- all the apps are then completely
independent of each other (even within the same virtual host). All you
need is to add a separate <Host> element in server.xml for each virtual
host, each with its own "appBase" directory.
Sorry, but I don't have a clue how to do it with the web connectors. I
consider any such configuration to be incredibly complex, and avoid them
like the plague (preferring to run Tomcat stand-alone).
> jchuang
>
Craig
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>
Re: class loading tc 3.3 & virtual hosts
Posted by James Chuang <dr...@earthlink.net>.
Yes you can. You can deploy 2 separate tomcat's each with their own ports,
contexts, etc. This will allow you to run your apps in 2 separate VMs, so
they can use different versions of classes etc.
This was in Tomcat 3.23-3.3. I think 4 should work the same way with this?
jchuang
----- Original Message -----
From: "Martin v. Boehlen" <bo...@tiade-voboe.de>
To: <to...@jakarta.apache.org>
Sent: Tuesday, January 08, 2002 2:04 PM
Subject: class loading tc 3.3 & virtual hosts
> 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 technik@tiade-voboe.de
> 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 boehlen@tiade-voboe.de
> 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: <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>