Re: Apache/Tomcat integration - What am I doing wrong?

2005-08-16 Thread Darryl L. Miles

Kyle wrote:

I have Apache serving multiple VHosts. I want to (eventually) 
integrate different versions of Tomcat into different VHosts, but for 
now, I'd settle for just 5.5.9 working with my default Apache VHost.


Apache works dandy alone on :80.
Tomcat works just fine on :8080.

I have the jsp-examples and servlets-examples pages displaying from 
host.domain.com/..


But I have not yet managed to get 
www.host.domain.com/prefix-examples/this_or_that_example to work 
without returning a 500 Error.


First is it apache or tomcat that is returning the 500 ?

This might be easiest found setting up logging of your specific VHost in 
apache to a different file than the default apache logs (that are in 
apache/logs/).  Then breaking the ServerName and ServerAlias 
configuration in apache (restarting apache inbetween) and checking to 
see that the request you put through with say wget is being directed 
by apache to the correct Apache VHost logfile.


I would revise your JkMount to look like:

JkMount  /admin/*  ajp13Wkr

This will pass-thru apache everything for the webapp to TC.


I would also remove inprocess from the worker.list settings.



Once you have that established you can then work on your JkMount 
settings and Tomcat.  Have you checked out, understood and implement the 
information in 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Host+Name+Aliases 
?



I suspect your only remaining problem now is to get Apache and Tomcat to 
see the same website document roots for the same URLs.  This maybe a 
problem if you are using deployed WARs since tomcat can and will delete 
the directory from under apache during the deployment process.






Likewise, I am unable to get the host.domain.com/admin, 
host.domain.com/manager/html or host.domain.com/manager/status to 
display over :80


Various errors I am seeing are;

File does not exist /opt/www/root/jsp-examples/this_or_that_example
File does not exist /opt/www/root/admin

or

/admin just displays the index.

Files look like this;



httpd.conf
==

ServerName host.domain.com:80
UseCanonicalName Off
DocumentRoot /opt/www/root
..
..

VirtualHost *:80
ServerAdmin [EMAIL PROTECTED]
ServerName host.domain.com
ErrorLog logs/host-defaulthost-error_log
CustomLog logs/host-defaulthost-access_log common

Include /opt/jakarta-tomcat-5.5.9/conf/auto/mod_jk.conf-hostname

/VirtualHost
--

server.xml
==

.

   Connector port=8009 enableLookups=false protocol=AJP/1.3/

Engine name=Catalina defaultHost=host.domain.com

Host name=host.domain.com appBase=webapps  unpackWARs=true 
autoDeploy=true

   xmlValidation=false xmlNamespaceAware=false

Aliaslocalhost/Alias

/Host

Listener className=org.apache.jk.config.ApacheConfig 
modJk=/opt/httpd/modules/mod_jk.so
   
workersConfig=/opt/jakarta-tomcat-5.5.9/conf/workers.properties 
forwardAll=false
   jkLog=/var/log/httpd/mod_jk.log jkDebug=info 
jkWorker=ajp13Wkr/


/Engine

  /Service

/Server
-- 



workers.properties
==

workers.tomcat_home=/opt/jakarta-tomcat-5.5.9
#workers.tomcat_home=/opt/tomcat

workers.java_home=/opt/java

ps=/

# The workers that your plugins should create and work with
#
worker.list=ajp13Wkr, inprocess

worker.ajp13Wkr.port=8009
worker.ajp13Wkr.host=host.domain.com
worker.ajp13Wkr.type=ajp13
worker.ajp13Wkr.lbfactor=1
worker.ajp13Wkr.cachesize=30

worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13Wkr

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)i386$(ps)client$(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 


worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
-


and the included file in the httpd.conf VHost above

mod-jk.conf-hostname


JkWorkersFile /opt/jakarta-tomcat-5.5.9/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel debug
JkLogStampFormat [%a %d %b %Y %H:%M:%S] 
JkOptions +ForwardKeySize +ForwardURICompat +ForwardDirectories
JkRequestLogFormat %w %V %T

# Static files
Alias /admin /opt/jakarta-tomcat-5.5.9/server/webapps/admin

Directory /opt/jakarta-tomcat-5.5.9/server/webapps/admin
Options Indexes FollowSymLinks
DirectoryIndex index.jsp index.html index.htm
Order allow,deny
Allow from All
/Directory


# Deny direct access to WEB-INF and META-INF
#
Location /admin/WEB-INF/*
AllowOverride None
  

Re: Apache/Tomcat integration - What am I doing wrong?

2005-08-16 Thread Kyle

Darryl,

thanks the reply.

Responses inline

Darryl L. Miles wrote:

Kyle wrote:

I have Apache serving multiple VHosts. I want to (eventually) 
integrate different versions of Tomcat into different VHosts, but for 
now, I'd settle for just 5.5.9 working with my default Apache VHost.


Apache works dandy alone on :80.
Tomcat works just fine on :8080.

I have the jsp-examples and servlets-examples pages displaying from 
host.domain.com/..


But I have not yet managed to get 
www.host.domain.com/prefix-examples/this_or_that_example to work 
without returning a 500 Error.



First is it apache or tomcat that is returning the 500 ?


I'll leave the 500 question till I can be certain of the answer. I 
thought it could only be Apache. Will however ensure now.


Then breaking the ServerName and ServerAlias 
configuration in apache (restarting apache inbetween) 


Not certain I understand what you mean here. Break them ... ?? Do you 
simply mean give the default VHost a diff. name to the general 
ServerName directive above?




I would revise your JkMount to look like:

JkMount  /admin/*  ajp13Wkr

This will pass-thru apache everything for the webapp to TC.


The multiple jkMount Directives are auto-generated by Tomcat. I could 
revise. I just thought it best to just leave them. I suspect they are so 
that IF I were to put any static content in those directories, Apache 
would pick it up instead.




Once you have that established you can then work on your JkMount 
settings and Tomcat.  Have you checked out, understood and implement the 
information in 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Host+Name+Aliases 
?

Interesting question. Read it, I have.

It is not however clear to me as to whether or not TC _MUST_ have a 
_Different_ VirtualHost Name than the default VHost name in Apache or 
whether it should be the same. And then whether or not an Alias can or 
cannot be the same as some other name for that same machine.


Does this mean effectively there should be 3 different names for the 
same machine to function in this manner? I.e.

The ServerName directive in httpd.conf
The ServerName for the default VHost AND
yet ANother different defaultHost/Host name for Tomcat

I suspect your only remaining problem now is to get Apache and Tomcat to 
see the same website document roots for the same URLs.  This maybe a 
problem if you are using deployed WARs since tomcat can and will delete 
the directory from under apache during the deployment process.


So far, I am only trying to view the examples and default admin app.s 
that come bundled with TC. If I understand you correctly here, you are 
effectively saying that the auto-conf file generated by TC is not up to 
the job and I should dump it in favour of manual inline config.


MTiA

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



Re: Apache/Tomcat integration - What am I doing wrong?

2005-08-16 Thread Darryl L. Miles

Kyle wrote:



But I have not yet managed to get 
www.host.domain.com/prefix-examples/this_or_that_example to work 
without returning a 500 Error.




First is it apache or tomcat that is returning the 500 ?



I'll leave the 500 question till I can be certain of the answer. I 
thought it could only be Apache. Will however ensure now.


Then breaking the ServerName and ServerAlias configuration in apache 
(restarting apache inbetween) 



Not certain I understand what you mean here. Break them ... ?? Do you 
simply mean give the default VHost a diff. name to the general 
ServerName directive above?



I mean when you are stuck and don't know.  Somethings are easier to 
deliberatly break the configuration and observe the result (i.e. where 
the error shows up now).   Since you are trying to work out if the 500 
is being produced directly from Apache or is a response apache is just 
relaying that really came from Tomcat.  It smells like apache to me, but 
until you can prove it you wont really know.


You need to confirm that requests for the vhost are being correctly 
routed into the VirtualHost section of the apache config.  If they are 
not then there is no sense looking at the JkMount configuration yet.  So 
if you have logging setup in apache both in the global config 
/usr/local/apache/log/access_log and in the VirtualHost ... section to 
/tmp/foobar/someother/file/access_log then depending upon which file the 
request gets logged will confirm to you that Apache is correctly 
configured and working for vhost operation and the VirtualHost ... 
section your JkMount's are in it indeed coming into play.




JkMount  /admin/*  ajp13Wkr

This will pass-thru apache everything for the webapp to TC.


I would revise your JkMount to look like:

The multiple jkMount Directives are auto-generated by Tomcat. I could 
revise. I just thought it best to just leave them. I suspect they are 
so that IF I were to put any static content in those directories, 
Apache would pick it up instead.


Yes.  But in the situation you are in, setting up /admin/* should make 
Apache bounce the request off Tomcat if it was not table to serve the 
content itself.  I am not at all sure what the order of preceedence is 
with mixing Alias, JkMount or if the file itself it found in the 
document root.


Once you have that established you can then work on your JkMount 
settings and Tomcat.  Have you checked out, understood and implement 
the information in 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Host+Name+Aliases 
?


Interesting question. Read it, I have.

It is not however clear to me as to whether or not TC _MUST_ have a 
_Different_ VirtualHost Name than the default VHost name in Apache 
or whether it should be the same. And then whether or not an Alias can 
or cannot be the same as some other name for that same machine.


Does this mean effectively there should be 3 different names for the 
same machine to function in this manner? I.e.

The ServerName directive in httpd.conf
The ServerName for the default VHost AND
yet ANother different defaultHost/Host name for Tomcat

Different No.  The idea is that you can service some content via Apache 
directly (maybe this is also PHP or Perl) and other content via 
Apache+Tomcat.  Apache is always in control, if the request is not 
forwarded to Tomcat then you will see the usual Apache like responses (404).


So if you want to a single hostname in the URL then you need to 
configure both Apache (ServerName/ServerAlias) and Tomcat (Host / 
Alias) to responsd to the same hostname.



I suspect your only remaining problem now is to get Apache and Tomcat 
to see the same website document roots for the same URLs.  This maybe 
a problem if you are using deployed WARs since tomcat can and will 
delete the directory from under apache during the deployment process.


So far, I am only trying to view the examples and default admin app.s 
that come bundled with TC. If I understand you correctly here, you are 
effectively saying that the auto-conf file generated by TC is not up 
to the job and I should dump it in favour of manual inline config.


No...  I'm not saying that I have no idea your Apache configuration was 
auto-generated by TC.  I'm just offering you a methodoligy to observe 
some change in behaviour so you can work through the problem yourself.




--
Darryl L. Miles



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