All of your JkMount statements need to be within the VirtualHost container for host1-app4, the one where it says "ServerName host1-app4.com".


Global JkMounts don't do much, and only work for Apache's default ServerName, which, in a virtual hosting environment, probably isn't going to help much.

For each VirtualHost where you have requests going to Tomcat, you want something like:

JkMount /*.jsp ajp13
JkMount /servlet/* ajp13

or:

<VirtualHost *:80>

ServerName host1-app4.com
DocumentRoot /var/apache/htdocs/app4

JkMount /admin ajp13
JkMount /admin/* ajp13

JkMount /cocoon ajp13
JkMount /cocoon/* ajp13

JkMount /DerivativesAdminWebsite ajp13
JkMount /DerivativesAdminWebsite/* ajp13

JkMount /manager ajp13
JkMount /manager/* ajp13

</VirtualHost>

I'm not clear what mod_jk.conf.hardcopy is exactly...if its output from an ApacheConfig Listener in server.xml, then you don't need to do anything at all, as it will have the appropriate Apache VirtualHost containers already in it. Basically, don't setup a VirtualHost container in httpd.conf for JK directives, and then another VirtualHost container for the actual virtual host definition...the JK directives that apply to that virtual host need to be in that virtual host's VirtualHost container.

John

On Thu, 27 Mar 2003 18:53:20 +0100, Gerstel, Rachel <[EMAIL PROTECTED]> wrote:

Hi All,

I am having trouble with Name Virtual Hosting for Apache 1.3.27 and tomcat
4.1.18 and mod_jk. Maybe someone can see something that I have overlooked.
And I apologize ahead of time if this is jumbled, but I have been at this
all day and my brain is pretty fried. :--)


I have one server with four name-based virtual hosts:
host1-app1
host1-app2
host1-app3
host1-app4

Only one of them needs tomcat - host1-app4. I tried adding/loading the jk
module in my httpd.conf directly and putting all the jk directives in my
virtual host container for that app, but then I got errors in my
/var/apache/logs/error_log saying:
[Thu Mar 27 18:22:27 2003] [error] Error while opening the workers, jk will
not work
[Thu Mar 27 18:22:28 2003] [error] (2)No such file or directory: Error while
opening the workers, jk will not work


So I am guessing that there was something wrong with the config. But, If I
just take out the jk directives (also removing the load/add module for jk),
put them in an include file and load jk from there then I get no errors. The
only problem is that then I get no page displayed when I try to go to one of
the pages which should be served by cocoon for host1-app4.


log messages from mod_jk.log:
[Thu Mar 27 18:44:07 2003] [jk_uri_worker_map.c (460)]: Into
jk_uri_worker_map_t::map_uri_to_worker
[Thu Mar 27 18:44:07 2003] [jk_uri_worker_map.c (477)]: Attempting to map
URI '/DerivativesAdminWebsite'
[Thu Mar 27 18:44:07 2003] [jk_uri_worker_map.c (599)]:
jk_uri_worker_map_t::map_uri_to_worker, done without a match


And you can see in apache error log that it is looking in the doc root
rather than tomcat:
[Thu Mar 27 18:47:15 2003] [error] [client 140.60.36.44] File does not
exist: /var/apache/htdocs/app4/cocoon/

server.xml:
<Server port="8005" shutdown="SHUTDOWN" debug="2">

<Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0" />
<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0" />


<!-- Global JNDI resources -->
<GlobalNamingResources>

<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>

</GlobalNamingResources>

<Service name="Tomcat-host1">

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="5" connectionTimeout="0"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

<Engine name="Engine-host1" defaultHost="host1" debug="2">

<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->

<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>

<!-- Because this Realm is here, an instance will be shared globally
-->

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase" />

<!-- Define the default virtual host -->
<Host name="host1-app4.com" address="<ip here>" debug="2"
appBase="webapps" unpackWARs="true" autoDeploy="true">

<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="/var/tomcat/logs"  prefix="host1_access_log."
suffix=".txt"
pattern="common" resolveHosts="false"/>

<Logger className="org.apache.catalina.logger.FileLogger"
directory="/var/tomcat/logs"  prefix="host1." suffix=".txt"
timestamp="true"/>

</Host>
</Engine>
</Service>
</Server>

$TOMCAT_HOME/conf/jk/workers.properties:

workers.tomcat_home=/usr/local/tomcat
workers.java_home=$(JAVA_HOME)
ps=/

worker.list=ajp13 worker.ajp13.port=8009
worker.ajp13.host=nutmeg
worker.ajp13.type=ajp13

worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps) sparcv9$(p
s)server$(ps)libjvm.so
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps) inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps) inprocess.stderr


$TOMCAT_HOME/conf/auto/mod_jk.conf.hardcopy

<IfModule !mod_jk.c>
LoadModule jk_module /usr/local/apache/libexec/mod_jk-1.3-eapi.so
</IfModule>

JkWorkersFile "/usr/local/tomcat/conf/jk/workers.properties"
JkLogFile "/usr/local/tomcat/logs/mod_jk.log"
JkLogLevel debug

<VirtualHost *:80>

JkMount /admin ajp13
JkMount /admin/* ajp13

JkMount /cocoon ajp13
JkMount /cocoon/* ajp13

JkMount /DerivativesAdminWebsite ajp13
JkMount /DerivativesAdminWebsite/* ajp13

JkMount /manager ajp13
JkMount /manager/* ajp13

</VirtualHost>

relevant httpd.conf entries:

NameVirtualHost *:80

<VirtualHost _default_:80>

ServerName host1-app1.com
DocumentRoot /var/apache/htdocs/app1

</VirtualHost>

<VirtualHost *:80>

ServerName host1-app2.com
DocumentRoot /var/apache/htdocs/app2

</VirtualHost>

<VirtualHost *:80>

ServerName host1-app3.com
DocumentRoot /var/apache/htdocs/app3

</VirtualHost>

<VirtualHost *:80>

ServerName host1-app4.com
DocumentRoot /var/apache/htdocs/app4

</VirtualHost>

Include /usr/local/tomcat/conf/auto/mod_jk.conf.hardcopy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to