Re: Newbie mod_jk question - Getting HTTP 404 error for existing servlets-examples directory

2007-11-20 Thread Rainer Jung

K S wrote:

Hi,

I am a newbie to both Apache and Tomcat.

I am using Apache 2.0.55, Tomcat 5.5.25, mod_jk 1.2.25 and Ubuntu (
2.6.17-10-server)

It seemed like I had the complete redirection working at one point, but
unfortunately after no apparent change (that I can recollect), things just
stopped working. I started troubleshooting by collecting detailed logs both
in Apache and Tomcat but the log information hasn't helped me much. So I was
wondering if anyone could suggest how I can go about finding what the issue
is.

My set up involved:

1. mod_jk.conf

LoadModule jk_module /YYY/lib/ApacheTomcat/mod_jk.so
JkWorkersFile /XXX/apache-tomcat-5.5.25/conf/jk/workers.properties


The space in the next line is hopefully not in the original file?


JkShmFile /XXX/apache-tomcat-5.5.25 /conf/jk/mod_jk.shm
JkLogFile /XXX/apache-tomcat-5.5.25/conf/jk/mod_jk.log
JkLogLevel trace
JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
JkRequestLogFormat %w %V %T
VirtualHost my.machine.name
ServerName my.machine.name
JkMount /servlets-examples worker1
JkMount /servlets-examples/* worker1
/VirtualHost

2. workers.properties



The next two lines are not used. Remove them.


workers.tomcat_home=/XXX/apache-tomcat-5.5.25
workers.java_home=/XXX/Java/jdk1.6.0_03
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=9009

3. apached.conf - Additions/Changes to the default file

(A) Include /XXX/apache-tomcat-5.5.25/conf/jk/mod_jk.conf

(B) LogFormat %v %V %h %l %u %t \%r\ %s %b status-%s port-%p filename-%f
reqMethod %m \%{Referer}i\ \%{User-Agent}i\ combined
LogFormat %v %V %h %l %u %t \%r\ %s %b common
LogFormat %v %V %{Referer}i - %U referer
LogFormat %v %V %{User-agent}i agent


4. Tomcat server.xml - Additions/Changes  to the default

(A) Engine name=Catalina defaultHost=bacis.vm.acis.intranet



Throw this listener out. It's only used for automatic configuration 
generation, which is partially broken, and you've got a configuration 
already.



Listener className=org.apache.jk.config.ApacheConfig
modJk=/XXX/lib/ApacheTomcat/mod_jk.so jkWorker=worker1 /

(B) Host name=my.machine.name appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

(C) !-- Define a non-SSL HTTP/1.1 Connector on port 8080 --
Connector port=9080 maxHttpHeaderSize=8192
maxThreads=150 minSpareThreads=25 maxSpareThreads=75
enableLookups=false redirectPort=8443 acceptCount=100
connectionTimeout=2 disableUploadTimeout=true /
!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 --

(D) !-- Define an AJP 1.3 Connector on port 8009 --
Connector port=9009
enableLookups=false redirectPort=8443 protocol=AJP/1.3 /

(E) Server port=9005 shutdown=SHUTDOWN

Here are the contents of mod_jk.log after I restart both Apache and Tomcat
and then make a request through my browser for
http://my.machine.name/servlets-examples. This URL used to (when things were
working) show me the standard Tomcat page with servlets examples such as
HelloWorld AND all the servlets worked.


...

For me it looks like something is wrong with the vhost. mod_jk by 
default doesn't inherit JkMounts between Vhosts. You put your JkMounts 
into a vhost (that's fine), but the log tells us, that during request 
processing, no JkMounts were defined. So I guess, that the request 
didn't get processed by this Vhost. I can see, that the name of the 
vhost gets logged in the access log, but still something seems to be 
wrong (maybe you defined another my.machine.name in some other file.


You can check, if it's a vhost problem:

- put the JkMounts in the global server config and set JkMountCopy On 
in all VirtualHost blocks. Then it should work again.
- add a separate CustomLog (separate file name) in the global server and 
in each vhost. This way you can easily detect, which vhost handled your 
request. Put the JkMounts into that vhost and remove the other ones and 
the JkMountCopy directives.


Regards,

Rainer




[Mon Nov 19 16:15:12 2007] [4075:3080226480] [debug] jk_child_init::mod_jk.c
(2692): Initialized mod_jk/1.2.25
[Mon Nov 19 16:15:12 2007] [4075:3080226480] [trace] jk_child_init::mod_jk.c
(2693): exit
[Mon Nov 19 16:17:01 2007] [4069:3080226480] [trace]
map_uri_to_worker::jk_uri_worker_map.c (542): enter
[Mon Nov 19 16:17:01 2007] [4069:3080226480] [debug]
map_uri_to_worker::jk_uri_worker_map.c (597): Attempting to map URI
'/servlets-examples' from 0 maps
[Mon Nov 19 16:17:01 2007] [4069:3080226480] [trace]
map_uri_to_worker::jk_uri_worker_map.c (645): exit





Apache's access.log

my.machine.name my.machine.name 10.5.X.X - - [19/Nov/2007:16:17:01 -0500]
GET /servlets-examples HTTP/1.1 404 337 status-404 port-80
filename-/var/www/servlets-examples reqMethod GET - Mozilla/5.0 (X11; U;
Linux i686; en-US; rv: 1.8.1.2) Gecko/20060601 Firefox/2.0.0.2
(Ubuntu-edgy)
my.machine.name my.machine.name 10.5.X.X - - [19/Nov/2007:16:17:01 -0500]
GET /favicon.ico HTTP/1.1 404 331 status-404 port-80

Re: Newbie mod_jk question - Getting HTTP 404 error for existing servlets-examples directory

2007-11-20 Thread K S
Thanks a lot Rainer! The problem as you guessed was with the Vhost.
After putting the JkMounts in the global server configuration, it
worked.

I started using the VHost (though now I have realised I don't need
them at all since I am not hosting more than one website on a single
server) because the automatically generated mod_jk.conf file had the
JkMounts within the VHost tags.

I have one clarification:

  (A) Engine name=Catalina defaultHost=bacis.vm.acis.intranet
 

 Throw this listener out. It's only used for automatic configuration
 generation, which is partially broken, and you've got a configuration
 already.

I would prefer to use the automatic configuration since it seems to
nicely include all the necessary JkMounts for each webapp in the
'webapps' directory. It saves me the extra step of having to modify
the mod_jk.conf file for each new webapp I add. But like I said, the
automatically generated mod_jk.conf file puts all the JkMounts in to
VirtualHost localhost VirtualHost set of tags. If I comment this
out and then restart apache it seems to work fine. Do you have any
suggestions on how this can be overcome or would it just be better to
avoid this auto generated file (since you say it is partially broken)
?

Thanks again!

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Newbie mod_jk question - Getting HTTP 404 error for existing servlets-examples directory

2007-11-20 Thread Rainer Jung

K S wrote:

Thanks a lot Rainer! The problem as you guessed was with the Vhost.
After putting the JkMounts in the global server configuration, it
worked.

I started using the VHost (though now I have realised I don't need
them at all since I am not hosting more than one website on a single
server) because the automatically generated mod_jk.conf file had the
JkMounts within the VHost tags.

I have one clarification:


(A) Engine name=Catalina defaultHost=bacis.vm.acis.intranet


Throw this listener out. It's only used for automatic configuration
generation, which is partially broken, and you've got a configuration
already.


I would prefer to use the automatic configuration since it seems to
nicely include all the necessary JkMounts for each webapp in the
'webapps' directory. It saves me the extra step of having to modify
the mod_jk.conf file for each new webapp I add. But like I said, the
automatically generated mod_jk.conf file puts all the JkMounts in to
VirtualHost localhost VirtualHost set of tags. If I comment this
out and then restart apache it seems to work fine. Do you have any
suggestions on how this can be overcome or would it just be better to
avoid this auto generated file (since you say it is partially broken)
?

Thanks again!


I would say, the auto-generated file might give you an easy start for a 
configuration, but for production purposes you might like to have a look 
at the connectors docs pages, especially concerning Apache config and 
workers.properties, to adjust the config to your needs.


Regards,

Rainer

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]