You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave Filchak <su...@zuka.net> on 2009/05/08 20:03:07 UTC

Configuration help with tomcat connectors

Hello all.

My name is Dave and I am new to this list and new to tomcat. I have been 
trying to set up tomcat with apache 2.2 for the last few days and have 
been unsuccessful in getting the connectors working with the supplied 
example files. It should be noted that accessing the tomcat server on 
8080 works fine. I have read the documentation and search the archives 
and while I have found some help, still have no happiness with the 
connectors.

When I go to http://my.servername.com:8080, the tomcat homepage comes up 
find.

When I go to http://my.servername.com/jsp/, I get a Page Not Found error.

So, I am hoping I can explain what I have done so far and someone could 
be kind enough to set me straight.

Installed:

jdk1.6.0_13 in /opt (I have also added the following symlink: ln -s 
/opt/ jdk1.6.0_13 /opt/java )
apache-tomcat-6.0.18 in /opt also with a symlink: ln -s 
/opt/apache-tomcat-6.0.18 /opt/tomcat
    Tomcat is set up as a service and runs with no errors
tomcat-connectors-1.2.28 and the mod_jk.so in installed in 
/usr/local/apache2/modules/mod_jk.so

I have created workers.properties in /etc/httpd/conf and I have used the 
workers.properties.minimal file as a template. It is as follows:

worker.list=worker1,worker2,wlb,jkstatus

#
# Defining a worker named ajp13w and of type ajp13
# Note that the name and the type do not have to match.
#
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

#
# Defining a load balancer (not sure I need this but left it in)
#

worker.wlb.type=lb
worker.wlb.balance_workers=ajp13w

worker.jkstatus.type=status

I have added the following to my httpd.conf file (I am using Virtualhosts)

#
# Mod_jk settings
#
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk shared memory
JkShmFile     /var/log/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel error
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send JSPs for context /jsp-examples to worker named default
JkMount /jsp/*.jsp worker1
# Send servlets-examples to worker named default
JkMount /servlets/* worker1

Finally, my server.xml file is left pretty much as it came (which I 
suspect may be part of my problem):

<?xml version='1.0' encoding='utf-8'?>


<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener
" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation a
t /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non
-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleLis
tener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLif
ecycleListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- 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 sav
ed"
              factory="org.apache.catalina.users.MemoryUserDatabaseF
actory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>


  <Service name="Catalina">
 
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- SingleSignOn valve, share authentication between web 
applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" 
directory="logs" 
               prefix="localhost_access_log." suffix=".txt" 
pattern="common" resolveHosts="false"/>
        -->

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

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
Caldarale, Charles R wrote:
>> From: Dave Filchak [mailto:submit@zuka.net]
>> Subject: Re: Configuration help with tomcat connectors
>>
>> If I set it up as localhost now, what is the impact if, 
>> in the future, I need to add other hosts?
>>     
>
> One <Host> must be the defaultHost, so its name is irrelevant other than it must match the defaultHost setting for the <Engine>.  Requests that don't match other <Host> names will be processed by the defaultHost, regardless of its name value.
>
>   
>>> Can you access the Tomcat examples and other webapps distributed
>>> with Tomcat via port 8080?
>>>       
>
> You haven't answered the above question yet.
>
>   
<snip>

Well ... I am happily (but sheepishly) reporting that all seems to be 
functioning as it should. I say sheepishly as it all finally came down 
to spelling ;-(  I missed, with all that staring at the code and the 
error messages, the fact, as Charles pointed out, that I had spelled 
appBase as appbase .... which are not the same in this case. Doh!!!!! 
Dumb but these things happen I guess.

There is a lot of information out there on how to do this but not all of 
it jives with each other so newcomers to Tomcat can become pretty 
confused. So, I say thank you to those who have helped be see the light, 
as it were. Both you Charles, and André have my thanks for taking time 
to help me out ;-)

Cheers

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Configuration help with tomcat connectors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Filchak [mailto:submit@zuka.net]
> Subject: Re: Configuration help with tomcat connectors
> 
> If I set it up as localhost now, what is the impact if, 
> in the future, I need to add other hosts?

One <Host> must be the defaultHost, so its name is irrelevant other than it must match the defaultHost setting for the <Engine>.  Requests that don't match other <Host> names will be processed by the defaultHost, regardless of its name value.

> > Can you access the Tomcat examples and other webapps distributed
> > with Tomcat via port 8080?

You haven't answered the above question yet.

> I was having trouble getting the two servers to play nice while 
> both are on port 80, even though I put Tomcat on a different IP.

Post your modified server.xml using the different IP address.  You will need to specify the IP address in each <Connector> element in order to avoid the default of 0.0.0.0 (all IP addresses).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
Charles,

Caldarale, Charles R wrote:
>
>   
>>     <Engine name="Catalina" defaultHost="test.mydomain.net">
>>         <Host name="test.mydomain.net" appbase="webapps"
>>     
>
> It's not necessary to change the <Host> name (or the defaultHost) if you only have one <Host> element, so I'd recommend changing both back to localhost.  You only need multiple <Host> names if you are serving multiple domains that have separate sets of webapps.
>   
While I am only going to be serving from one host now, it is quite 
conceivable that there will be more in the future. So, I was keeping 
that in mind while trying to set this up. If I set it up as localhost 
now, what is the impact if, in the future, I need to add other hosts?
>   
>>         <Context path="" docBase="webapps/ROOT/"/>
>>     
>
> The above must be removed, for several reasons: 1) it is incorrect, since a relative docBase is relative to the <Host> appBase, so it should have been just "ROOT"; 2) it is redundant, in that any directory under the appBase directory will automatically be considered to be a context; and, 3) putting <Context> elements in server.xml is strongly discouraged.  Any <Context> elements (if needed at all) belong in the webapp's META-INF/context.xml file, or in conf/Catalina/[host]/[appName].xml.  Get rid of it.
>   
I have done so and now, while I still get a 404 when trying to access 
say the docs or manager, I now, rather than a 404 error, get a blank 
page when I try to access the jsp or servlet examples. Not sure if this 
is progress or not ;-)
>   
>>         <Logger classname="org.apache.catalina.logger.FileLogger"/>
>>     
>
> The above is not useful - <Logger> elements have not been used in Tomcat for several years.
>   
OK
>   
>> So, it obviously is not mounting the /examples directory (but
>> perhaps this is not possible? Does it have to be a WAR file?).
>>     
>
> No, webapps can be either .war files or directories.
>   
Ok good to know.
>   
>> WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting
>> property 'appbase' to 'webapps' did not find a matching property.
>>     
>
> The above is due to the invalid <Context> element in server.xml.
>   
Yeah I see now that this error has disappeared since I removed the docBase
>   
>> WARNING:   No rules found matching 'Server/Service/Engine/Host/Logger'.
>>     
>
> The above is due to the invalid <Logger> element in server.xml.
>   
Check
>   
>> INFO: The APR based Apache Tomcat Native library which allows optimal
>> performance in production environments was not found on the
>> java.library.path:
>>     
>
> The above is ignorable.  You can install APR primarily for improved SSL performance; but if you're front-ending Tomcat with httpd, you should have httpd handle the SSL as well.
>
>   
>> I believe I am understanding the theory and think I am close on the
>> actual setup but I am surely missing something here. I think it must be
>> the JkMount settings or some other setting I have missed.
>>     
>
> Can you access the Tomcat examples and other webapps distributed with Tomcat via port 8080?  If so, then the Tomcat installation is working, and it's just the mod_jk config that's wrong.  Again, if you don't really need httpd, why are you making your life more difficult (and impacting performance) by trying to use it?
>   
My explanation is at the beginning of this response. And, I was having 
trouble getting the two servers to play nice while both are on port 80, 
even though I put Tomcat on a different IP. But, I could have screwed up 
the config.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Configuration help with tomcat connectors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Filchak [mailto:submit@zuka.net]
> Subject: Re: Configuration help with tomcat connectors
> 
> <Host name="test.mydomain.net" appbase="webapps"
>               unpackWARs="true" autoDeploy="true"
>               xmlValidation="false" xmlNamespaceAware="false">
> </Host>

You have misspelled appBase - these are all case sensitive.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
Charles,

Caldarale, Charles R wrote:
>   
>> WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting
>> property 'appbase' to 'webapps' did not find a matching property.
>>     
>
> The above is due to the invalid <Context> element in server.xml.
>   
I have removed the offending <Context> element but I am still getting:

WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting 
property 'appbase' to 'webapps' did not find a matching property.

This is what I now have:

<Host name="test.mydomain.net" appbase="webapps"
              unpackWARs="true" autoDeploy="true"
              xmlValidation="false" xmlNamespaceAware="false">
</Host>


Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Configuration help with tomcat connectors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Filchak [mailto:submit@zuka.net]
> Subject: Re: Configuration help with tomcat connectors

>     <Engine name="Catalina" defaultHost="test.mydomain.net">
>         <Host name="test.mydomain.net" appbase="webapps"

It's not necessary to change the <Host> name (or the defaultHost) if you only have one <Host> element, so I'd recommend changing both back to localhost.  You only need multiple <Host> names if you are serving multiple domains that have separate sets of webapps.

>         <Context path="" docBase="webapps/ROOT/"/>

The above must be removed, for several reasons: 1) it is incorrect, since a relative docBase is relative to the <Host> appBase, so it should have been just "ROOT"; 2) it is redundant, in that any directory under the appBase directory will automatically be considered to be a context; and, 3) putting <Context> elements in server.xml is strongly discouraged.  Any <Context> elements (if needed at all) belong in the webapp's META-INF/context.xml file, or in conf/Catalina/[host]/[appName].xml.  Get rid of it.

>         <Logger classname="org.apache.catalina.logger.FileLogger"/>

The above is not useful - <Logger> elements have not been used in Tomcat for several years.

> So, it obviously is not mounting the /examples directory (but
> perhaps this is not possible? Does it have to be a WAR file?).

No, webapps can be either .war files or directories.

> WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting
> property 'appbase' to 'webapps' did not find a matching property.

The above is due to the invalid <Context> element in server.xml.

> WARNING:   No rules found matching 'Server/Service/Engine/Host/Logger'.

The above is due to the invalid <Logger> element in server.xml.

> INFO: The APR based Apache Tomcat Native library which allows optimal
> performance in production environments was not found on the
> java.library.path:

The above is ignorable.  You can install APR primarily for improved SSL performance; but if you're front-ending Tomcat with httpd, you should have httpd handle the SSL as well.

> I believe I am understanding the theory and think I am close on the
> actual setup but I am surely missing something here. I think it must be
> the JkMount settings or some other setting I have missed.

Can you access the Tomcat examples and other webapps distributed with Tomcat via port 8080?  If so, then the Tomcat installation is working, and it's just the mod_jk config that's wrong.  Again, if you don't really need httpd, why are you making your life more difficult (and impacting performance) by trying to use it?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
André Warnier wrote:

<snip>

André,

Thanks very much for taking the time to write this very helpful and 
detailed response. I truly appreciate it.

I have basically come to terms with most of the theory in what you are 
saying here and slowly the light is coming on.  ... BUT ....

I have managed to get my test app/site to bring up the $CATALINA_HOME 
default welcome page but I suspect that the only reason for this is that 
is where the config for this test site is pointing to as the doc root. 
What still is not happening is accessing say the example files from the 
test site. I do not have a WAR file yet so I am trying to use the 
example files.

If you don't mind, what I would like to do is give you a quick rundown 
of what I have done so far and what I am currently experiencing with 
this setup as it is now.

1. First, I have set up DNS so that it points to a test site i.e. 
test.mydomain.net
2. I have added a virtual domain to the apache (httpd) config i.e.

<VirtualHost * :80>
    ServerName test.mydomain.net
    DocumentRoot /opt/tomcat/webapps/ROOT
    <Directory /opt/tomcat/webapps/ROOT>
     Options none
     AllowOverride None
     Order allow,deny
     allow from all
    </Directory>
    ErrorLog logs/test.errors
    CustomLog logs/test.access combined
    JkMount /examples exodus
    JkMount /examples/* exodus
    JkUnMount  /images/* exodus
</VirtualHost>

3. I edited my server.xml file to:

<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.AprLifecycleListener" 
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener 
className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<GlobalNamingResources>
    <!-- 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"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

<Service name="Catalina">

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <Engine name="Catalina" defaultHost="test.mydomain.net">
        <Host name="test.mydomain.net" appbase="webapps"
                   unpackWARs="true" autoDeploy="true"
                   xmlValidation="false" xmlNamespaceAware="false">
        <Context path="" docBase="webapps/ROOT/"/>
        <Logger classname="org.apache.catalina.logger.FileLogger"/>
        </Host>

    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
</Engine>
  </Service>
</Server>

4. my workers.properties file (/etc/httpd/conf)

worker.list=exodus

worker.exodus.type=ajp13
worker.exodus.host=localhost
worker.exodus.port=8009
worker.exodus.lbfactor=1

So, what happens now is that I can go to test.mydomain.net and yes, it 
loads the default tomcat welcome page. However, when I try to go to any 
of the links on the sidebar for the examples, I get the tomcat 404 
error. So, it obviously is not mounting the /examples directory (but 
perhaps this is not possible? Does it have to be a WAR file?).

catalina.out only says the following (as far as warnings or errors):

WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting 
property 'appbase' to 'webapps' did not find a matching property.
WARNING:   No rules found matching 'Server/Service/Engine/Host/Logger'.
INFO: The APR based Apache Tomcat Native library which allows optimal 
performance in production environments was not found on the 
java.library.path: 
/usr/opt/jdk1.6.0_13/jre/lib/amd64/server:/usr/opt/jdk1.6.0_13/jre/lib/amd64:/usr/opt/jdk1.6.0_13/jre/../lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib

Otherwise, everything else looks normal. (as normal as I can tell  ... 
anyway)

catalina.err shows no errors.

mod_jk.log only shows:

[Sat May 09 18:28:45 2009] [24192:2517219392] [info] init_jk::mod_jk.c 
(3183): mod_jk/1.2.28 initialized

and

[Sat May 09 18:45:04 2009] exodus test.mydomain.net 0.004250

And of course, the error log for the site shows these urls and files as 
not existing.

I believe I am understanding the theory and think I am close on the 
actual setup but I am surely missing something here. I think it must be 
the JkMount settings or some other setting I have missed.

I appreciate your indulgence while I get this together.

Cheers

Dave




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by André Warnier <aw...@ice-sa.com>.
Dave Filchak wrote:
...
Hi.
Since the simple answer did not work (or was not sufficient), and since 
on the other hand you seem to be wanting to understand what you are 
doing, let me try to give you an overview.

For short, I will use "Apache" when I mean Apache httpd, and Tomcat to 
mean the Apache Tomcat servlet engine/container.

You have an Apache server listening on port 80, and processing requests 
directed there.
For some of these requests however, you would like Apache to "proxy" 
them to a back-end Tomcat server, to be processed there.  The result of 
that back-end processing should then be returned to Apache, so that 
Apache can return them to the browser.

This requires a "connector", both at the Apache side and at the Tomcat 
side.  That is like a plug on each side, with a wire in-between.
On that wire will circulate the requests that Apache passes to Tomcat, 
and the response that Tomcat sends to Apache.

At the Tomcat side, the "plug" is a <Connector> element.  This Connector 
specifies a port number it will listen to, and a protocol it will use.
Since you started with mod_jk as a connector module at the Apache side, 
this port is by default usually set to 8009; the protocol is alway "AJP".

Now the issue is to configure the plug on the Apache side, namely the 
mod_jk connector.
mod_jk is a sophisticated animal, which can do a host of things apart 
from the simple one we need here : it can talk to multiple Tomcat 
back-ends, it can load-balance between them, detect availability and 
failures of the back-ends etc..
That is what all these "extra" Jk parameters are all about, which I will 
not discuss here since they are already excellently described in the 
on-line documentation.  Instead, let's stick to the essentials.

Basically, we have to
- tell Apache to load the mod_jk module,
- and then tell mod_jk the following :
   - which requests it should "grab" at the Apache level, and pass to Tomcat
   - where this Tomcat is, in terms of IP address and port (that is, in 
this case, the IP address of the host where Tomcat runs, and the port on 
which the Tomcat AJP connector is listening).

To tell Apache to load the mod_jk module, there is an Apache 
configuration directive similar to this :

LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so

That's it. The mod_jk module gets initialised, and in the process it 
tells Apache which other configuration directives it will handle.
When Apache later finds these in its configuration, it will call mod_jk 
to process them.

Next we need these configuration directives, which tell mod_jk what to 
do.  There are usually the following :

First, tell mod_jk where and what to log :

JkLogFile /var/log/apache2/mod_jk12.log
JkLogLevel info

(That is quite important for debugging.  Examining this file will show 
you what mod_jk is doing (or not doing), and will usually point to the 
problems right away.)

Then, we tell mod_jk in which other configuration file it will find a 
description of the Tomcat's it should be talking to :

JkWorkersFile /etc/apache2/workers.properties

(in mod_jk language, these Tomcats are called "workers", hence the name 
above)

In that file, we'll for now just use the essentials :

worker.list=anyname
worker.anyname.port=8009
worker.anyname.host=localhost
worker.anyname.type=ajp13

That is really all that's needed if you have a single Tomcat in the 
background to talk to.
I purposedly used "anyname" above to indicate that a worker name can be 
anything you choose, it does not have to be "worker1" or "ajp13" as 
you'll often see in default configurations.  But remember the name you 
gave this worker, because you'll need it at the next step.
(For more Tomcats, see the comment under (*) below)

Now we have one part left : let Apache know which requests should go to 
Tomcat.
In fact, it is not really Apache we are telling this to, it is mod_jk 
itself.  mod_jk registers itself with Apache as a "content handler". 
Whenever Apache has to generate content, it will ask each of these 
content handlers in turn if it wants to have a go at it.  mod_jk is 
called, so it gets a go at examining the current URL, and decide if it 
wants to process that URL or not (for mod_jk, processing a URL means 
passing it to Tomcat, and letting Tomcat do the work).

To tell thus mod_jk which URLs we want it to handle, there are the 
JkMount and JkUnMount instructions, like :

JkMount /myapp anyname
JkMount /myapp/* anyname

Why two ? because the syntax of the middle part is somewhat 
narrow-minded (Rainer would say that it is very precise). If we say 
"/myapp" it means "/myapp" and not anything else (like 
"/myapp/something"). So to let it know that it should process calls to 
"/myapp" /and also/ anything below "/myapp", we need these two lines.

Notice also the "anyname" ? that is the name we gave to our worker, in 
the workers.properties file.  This is so that, now that mod_jk has 
decided to process the current request for "/myapps/something", it would 
know to which Tomcat to pass this request.

And JkUnMount ?
That is kind of if, after telling mod_jk to process anything below 
"/myapp", you have second thoughts, and decide that after all "certain 
things" below there it should not process, but instead it should decline 
and tell Apache "no, this is not for me, please handle that yourself".
(See (**) below.)
It could be for instance this kind of thing :

JkUnMount *.gif anyname

thus telling mod_jk : "ok, process all the calls for /myapp, except if 
this concerns a gif image. In that case, let Apache do it."


While this was not a direct answer to your question, does it help ?



Note (*) :
If you had two Tomcats, then you'd have something like

worker.list=anyname,anothername

and another section of 3 lines defining where your "anothername" worker 
can be found :
worker.anothername.port=8009
worker.anothername.host=anotherhost
worker.anothername.type=ajp13

Note (**) :
That is in fact exactly what it does.  Instead of passing the request to 
Tomcat, and reading the answer from Tomcat, and passing the answer back 
to Apache, it returns a special status code to Apache : DECLINE.
That causes Apache to pass the request to the next propective handler in 
the chain.  If Apache then does not find any other "special" handler 
like mod_jk that wants this request, it will process it itself, using 
its own default handler (which just reads and returns the gif file e.g.).




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
André Warnier wrote:
> Hi.
> Just for a start, add a line after this one :
> > # Send JSPs for context /jsp-examples to worker named default
> > JkMount /jsp/*.jsp worker1
> JkMount /jsp worker1
>
> and just try again (after restarting Apache)
>
> Note : I also think you've got way too many workers there, including a 
> load balancer that you don't really need, for one Tomcat ;-)
André, thanks for your reply. I have added the line as you suggested i.e.

# Send JSPs for context /jsp-examples to worker named default
JkMount /jsp/*.jsp worker1
JkMount /jsp worker1

I still get a page not found error.

I also cleaned up the workers.properties file to get rid of at least the 
load balancer. I was also wondering, do I not have to add a Listener to 
the workers.properties file for the connector?

Dave
>
>
> <snip>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by André Warnier <aw...@ice-sa.com>.
Hi.
Just for a start, add a line after this one :
 > # Send JSPs for context /jsp-examples to worker named default
 > JkMount /jsp/*.jsp worker1
JkMount /jsp worker1

and just try again (after restarting Apache)

Note : I also think you've got way too many workers there, including a 
load balancer that you don't really need, for one Tomcat ;-)


Dave Filchak wrote:
> Hello all.
> 
> My name is Dave and I am new to this list and new to tomcat. I have been 
> trying to set up tomcat with apache 2.2 for the last few days and have 
> been unsuccessful in getting the connectors working with the supplied 
> example files. It should be noted that accessing the tomcat server on 
> 8080 works fine. I have read the documentation and search the archives 
> and while I have found some help, still have no happiness with the 
> connectors.
> 
> When I go to http://my.servername.com:8080, the tomcat homepage comes up 
> find.
> 
> When I go to http://my.servername.com/jsp/, I get a Page Not Found error.
> 
> So, I am hoping I can explain what I have done so far and someone could 
> be kind enough to set me straight.
> 
> Installed:
> 
> jdk1.6.0_13 in /opt (I have also added the following symlink: ln -s 
> /opt/ jdk1.6.0_13 /opt/java )
> apache-tomcat-6.0.18 in /opt also with a symlink: ln -s 
> /opt/apache-tomcat-6.0.18 /opt/tomcat
>    Tomcat is set up as a service and runs with no errors
> tomcat-connectors-1.2.28 and the mod_jk.so in installed in 
> /usr/local/apache2/modules/mod_jk.so
> 
> I have created workers.properties in /etc/httpd/conf and I have used the 
> workers.properties.minimal file as a template. It is as follows:
> 
> worker.list=worker1,worker2,wlb,jkstatus
> 
> #
> # Defining a worker named ajp13w and of type ajp13
> # Note that the name and the type do not have to match.
> #
> worker.worker1.type=ajp13
> worker.worker1.host=localhost
> worker.worker1.port=8009
> 
> #
> # Defining a load balancer (not sure I need this but left it in)
> #
> 
> worker.wlb.type=lb
> worker.wlb.balance_workers=ajp13w
> 
> worker.jkstatus.type=status
> 
> I have added the following to my httpd.conf file (I am using Virtualhosts)
> 
> #
> # Mod_jk settings
> #
> # Load mod_jk module
> LoadModule jk_module modules/mod_jk.so
> # Where to find workers.properties
> JkWorkersFile /etc/httpd/conf/workers.properties
> # Where to put jk shared memory
> JkShmFile     /var/log/httpd/mod_jk.shm
> # Where to put jk logs
> JkLogFile logs/mod_jk.log
> # Set the jk log level [debug/error/info]
> JkLogLevel error
> # Select the log format
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
> # JkOptions indicate to send SSL KEY SIZE,
> JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
> # JkRequestLogFormat set the request format
> JkRequestLogFormat "%w %V %T"
> # Send JSPs for context /jsp-examples to worker named default
> JkMount /jsp/*.jsp worker1
> # Send servlets-examples to worker named default
> JkMount /servlets/* worker1
> 
> Finally, my server.xml file is left pretty much as it came (which I 
> suspect may be part of my problem):
> 
> <?xml version='1.0' encoding='utf-8'?>
> 
> 
> <Server port="8005" shutdown="SHUTDOWN">
> 
>  <!--APR library loader. Documentation at /docs/apr.html -->
>  <Listener className="org.apache.catalina.core.AprLifecycleListener
> " SSLEngine="on" />
>  <!--Initialize Jasper prior to webapps are loaded. Documentation a
> t /docs/jasper-howto.html -->
>  <Listener className="org.apache.catalina.core.JasperListener" />
>  <!-- JMX Support for the Tomcat server. Documentation at /docs/non
> -existent.html -->
>  <Listener className="org.apache.catalina.mbeans.ServerLifecycleLis
> tener" />
>  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLif
> ecycleListener" />
> 
>  <!-- Global JNDI resources
>       Documentation at /docs/jndi-resources-howto.html
>  -->
>  <GlobalNamingResources>
>    <!-- 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 sav
> ed"
>              factory="org.apache.catalina.users.MemoryUserDatabaseF
> actory"
>              pathname="conf/tomcat-users.xml" />
>  </GlobalNamingResources>
> 
> 
>  <Service name="Catalina">
> 
>            unpackWARs="true" autoDeploy="true"
>            xmlValidation="false" xmlNamespaceAware="false">
> 
>        <!-- SingleSignOn valve, share authentication between web 
> applications
>             Documentation at: /docs/config/valve.html -->
>        <!--
>        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
>        -->
> 
>        <!-- Access log processes all example.
>             Documentation at: /docs/config/valve.html -->
>        <!--
>        <Valve className="org.apache.catalina.valves.AccessLogValve" 
> directory="logs"               prefix="localhost_access_log." 
> suffix=".txt" pattern="common" resolveHosts="false"/>
>        -->
> 
>      </Host>
>    </Engine>
>  </Service>
> </Server>
> 
> Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by André Warnier <aw...@ice-sa.com>.
Caldarale, Charles R wrote:
>> From: Dave Filchak [mailto:submit@zuka.net]
>> Subject: Configuration help with tomcat connectors
>>
>> I have been trying to set up tomcat with apache 2.2 for the last 
>> few days and have been unsuccessful in getting the connectors 
>> working with the supplied example files.
> 
> Before proceeding any further, do you really need httpd in front of Tomcat?  What purpose is it serving?
> 
To balance his Tomcat, duh.

(Dave, ignore this, just a little joke.)
;-)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Configuration help with tomcat connectors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Filchak [mailto:submit@zuka.net]
> Subject: Re: Configuration help with tomcat connectors
> 
>     1a: I assume that if the DNS for a particular virtualhost (domain)
> points to this new IP, the tomcat server will serve the correct files
> based on the context?

True.

> 2. Modify the server.xml file to reference each virtualhost you want to
> serve i.e.
> 
> <Engine name="Catalina" defaultHost="virtualhost1">
>     <Host name="virtualhost1"    appBase="virtualhost1apps"/>
>     <Host name="virtualhost2"    appBase="virtualhost2apps"/>
> </Engine>

Virtual hosts are necessary if the URLs for the two domains would otherwise be in conflict (e.g., you want a separate default webapp for each domain.

> 3. Create directories for each of the virtual hosts in the tomcat
> directory i.e.:
> 
> mkdir $CATALINA_HOME/virtualhost1apps
> mkdir $CATALINA_HOME/virtualhost2apps

The appBase directories are not required to be under Tomcat's home directory, but it's perfectly o.k. to put them there if you want.

>     a: create a META-INF directory inside of the Context and place a
> context.xml in it i.e. $CATALINA_HOME/virtualhost1apps/META-
> INF/context.xml

The location is incorrect - it leaves out the context name.  Each <Host> can have multiple webapps deployed under it, with the only restriction being that the default webapp must be named ROOT (case sensitive).  So if you are referring to the default webapp for virtualhost1, the proper location would be:
$CATALINA_HOME/virtualhost1apps/ROOT/META-INF/context.xml

Note that if you have nothing interesting to put in the <Context> element for a given webapp, you don't need the context.xml file at all.

> Now, being as I am a tomcat rookie and just learning this stuff ... can
> you or someone explain the difference between docroot and approot?

I'll assume you mean docBase and appBase.  The appBase directory is the default location under which webapps for a given <Host> are deployed.  A docBase is the location (directory or .war file) of an individual webapp.  The docBase attribute of a <Context> element is only used when the webapp is deployed outside of the <Host> appBase directory; otherwise it is derived automatically just from the webapp's existence under appBase.

> Does one hold static html and the other jsp etc?

No; each webapp can consist of any combination of static and dynamic content.  It's not uncommon for simple webapps to have no dynamic content, and be composed of just .html, .css, .jpg, etc.

> Where is docroot declared?

Assuming you mean docBase, it's usually not.  The docBase and path are derived from the location of the webapp under appBase.

Look at what comes in the standard Tomcat download: each of the directories under the <Host> appBase directory (webapps, by default) is a separate webapp.  At least one (docs) is static content only, while most are a combination of static and dynamic.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
Caldarale, Charles R wrote:
>> From: Dave Filchak [mailto:submit@zuka.net]
>> Subject: Re: Configuration help with tomcat connectors
>>
>> So, can you clarify what you mean by standalone?
>>     
>
> Not front-ended by httpd or other web server.
>
>   
>> Right now it is running on port 8080 and I have other sites 
>> running on this server on the standard port 80.
>>     
>
> So you are using httpd for something besides serving static content?
>
>   
>> Can the standalone run on the server along side of
>> apache and share port 80
>>     
>
> If by "apache" (which is an open-source software organization) you really mean httpd, then no, two servers cannot share a single port on the same IP address.  You have several options:
>
> A) Run the Tomcat web sites on a different IP address using port 80, not front ended by httpd.
>
> B) Continue to run httpd on port 80, and use mod_jk or mod_proxy to pass the relevant requests to Tomcat (i.e., what you're trying to do now, with apparently little success).
>
> C) Put all of your web sites under Tomcat, eliminating httpd altogether.  This works *only* if you're not using httpd for something more esoteric, such as running PHP.
>
> Options A or B are likely easier in the short term, C would be the simplest for the long term.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   
OK well, I could do either A or B but would really like to understand 
why B on my current server is not functioning.

However, perhaps you can confirm the setup for me? The way I understand 
it is:

1. set up TOMCAT as a standalone server and change the listening port to 
port 80 (only works if there is not another server running on port 80. 
Otherwise you need to add another public IP to the server)
    1a: I assume that if the DNS for a particular virtualhost (domain) 
points to this new IP, the tomcat server will serve the correct files 
based on the context?

2. Modify the server.xml file to reference each virtualhost you want to 
serve i.e.
      

<Engine name="Catalina" defaultHost="virtualhost1">
    <Host name="virtualhost1"    appBase="virtualhost1apps"/>
    <Host name="virtualhost2"    appBase="virtualhost2apps"/>
</Engine>
   
3. Create directories for each of the virtual hosts in the tomcat 
directory i.e.:

mkdir $CATALINA_HOME/virtualhost1apps
mkdir $CATALINA_HOME/virtualhost2apps

4. Configure the contexts (this is where it gets a bit murky for me)

    a: create a META-INF directory inside of the Context and place a 
context.xml in it i.e. $CATALINA_HOME/virtualhost1apps/META-INF/context.xml

Now, being as I am a tomcat rookie and just learning this stuff ... can 
you or someone explain the difference between docroot and approot? Does 
one hold static html and the other jsp etc? Where is docroot declared?

Thanks

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Configuration help with tomcat connectors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Filchak [mailto:submit@zuka.net]
> Subject: Re: Configuration help with tomcat connectors
> 
> So, can you clarify what you mean by standalone?

Not front-ended by httpd or other web server.

> Right now it is running on port 8080 and I have other sites 
> running on this server on the standard port 80.

So you are using httpd for something besides serving static content?

> Can the standalone run on the server along side of
> apache and share port 80

If by "apache" (which is an open-source software organization) you really mean httpd, then no, two servers cannot share a single port on the same IP address.  You have several options:

A) Run the Tomcat web sites on a different IP address using port 80, not front ended by httpd.

B) Continue to run httpd on port 80, and use mod_jk or mod_proxy to pass the relevant requests to Tomcat (i.e., what you're trying to do now, with apparently little success).

C) Put all of your web sites under Tomcat, eliminating httpd altogether.  This works *only* if you're not using httpd for something more esoteric, such as running PHP.

Options A or B are likely easier in the short term, C would be the simplest for the long term.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
Caldarale, Charles R wrote:
>> From: Dave Filchak [mailto:submit@zuka.net]
>> Subject: Re: Configuration help with tomcat connectors
>>     
>
>   
>> So, I am told there will be static content as well as JSP pages.
>>     
>
> Tomcat does an excellent job of serving static content all by itself.  Unless you have some other compelling need to run httpd (e.g., PHP, poor man's load balancing), I'd strongly recommend that you run Tomcat standalone and simplify your life.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   
So, can you clarify what you mean by standalone? Right now it is running 
on port 8080 and I have other sites running on this server on the 
standard port 80. Can the standalone run on the server along side of 
apache and share port 80 or is there something I am missing here?

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Configuration help with tomcat connectors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Filchak [mailto:submit@zuka.net]
> Subject: Re: Configuration help with tomcat connectors

> So, I am told there will be static content as well as JSP pages.

Tomcat does an excellent job of serving static content all by itself.  Unless you have some other compelling need to run httpd (e.g., PHP, poor man's load balancing), I'd strongly recommend that you run Tomcat standalone and simplify your life.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Configuration help with tomcat connectors

Posted by Dave Filchak <su...@zuka.net>.
Caldarale, Charles R wrote:
>> From: Dave Filchak [mailto:submit@zuka.net]
>> Subject: Configuration help with tomcat connectors
>>
>> I have been trying to set up tomcat with apache 2.2 for the last 
>> few days and have been unsuccessful in getting the connectors 
>> working with the supplied example files.
>>     
>
> Before proceeding any further, do you really need httpd in front of Tomcat?  What purpose is it serving?
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   
There will be static content, at least, as far as I know. We host a 
number of domains for charitable and not-for-profit organizations and 
this particular site is being brought over from another host. So, I am 
told there will be static content as well as JSP pages.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Configuration help with tomcat connectors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Filchak [mailto:submit@zuka.net]
> Subject: Configuration help with tomcat connectors
> 
> I have been trying to set up tomcat with apache 2.2 for the last 
> few days and have been unsuccessful in getting the connectors 
> working with the supplied example files.

Before proceeding any further, do you really need httpd in front of Tomcat?  What purpose is it serving?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org