Trying to provide some limited help peppered across your message..

Dave Filchak wrote:
A few days ago, a number of you helped me get tomcat up and running with the example files shipped with the default install of tomcat. Just as a reminder, I am on CentOS 5.4/64 bit system using jdk1.6.1_13, apache tomcat 6.0.18.

I was going through this exercise because I was given a tomcat based site to host for the next while. Having never dealt with tomcat before, with the help of a few members of this list, I managed to get tomcat running. So then I came to the task of getting this site going. So, here is what I did an I hope if anyone sees anything off base (likely) they will point it out to me.

First I created a war file of the site pages using java -cvf exodus.war *

That was more likely "jar -cvf exodus.war *", right ?

I then put the war file inside my webapps directory at /usr/opt/tomcat/webapps/ (this is the same directory for my default host)

Ok, so we assume your tomcat's CATALINA_HOME and CATALINA_BASE are both /usr/opt/tomcat, and below that you have directories like
- bin
- conf
- webapps
- logs
right ?



I then restarted tomcat and it expanded the war file to create a directory under webapps called exodus In this new directory, there is a WEB-INF directory and a META-INF directory.

That looks ok so far.

I edited the web.xml file from inside WEB-INF to reflect the current server environment, which included the following:
   <context-param>
  <param-name>root</param-name>

.. etc..
that unfortunately is a part we cannot help you with, probably. It is a series of parameters specific to that "exodus" application which probably nobody here knows.

That comment extends all the way to
...

</paths> (Sorry if the above was not necessary to send but wanted to be thorough).


My server.xml file was edited to look like this:

<?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 at /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.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListen
er" />
<!-- <Listener className="org.apache.ajp.tomcat.config.ApacheConfig" modJk="/usr/local/apache2/modules/mod_jk.so" /> -->

 <!-- 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 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" />


Note that, apparently, you only have an AJP connector listening on port 8009. You do not have one for port 8010.


   <Engine name="Catalina" defaultHost="localhost">
   <Host name="localhost" appBase="webapps"
         unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">
       </Host>

   <Host name="exodus.zuka.net" appBase="webapps/exodus"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
   </Host>

So, are we to think that this server is known in DNS by the name "exodus.zuka.net" ?


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

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

With this, I am wondering if I have the exodus directory in the right place as it crosses into the default host space.

My workers.properties file now looks like:

worker.list=rosewood,exodus

#
# Defining a worker named ajp13w and of type ajp13
# Note that the name and the type do not have to match.
#

worker.rosewood.type=ajp13
worker.rosewood.host=localhost
worker.rosewood.port=8009

worker.exodus.type=ajp13
worker.exodus.host=exodus.zuka.net

Here you should better say, also,
> worker.exodus.host=localhost


worker.exodus.port=8010

That is why I am surprised that there is no <Connector> for port 8010 in your server.xml. If we are talking all about the same single host, then you need to add it. Just copy the one for 8009 and change the port number.

Otherwise, the worker "exodus" won't be able to connect to Tomcat.

(In fact, if this is all on the same system, I think you can simplify this configuration, but let's first try and make this one work).



I have then modified the apache conf and added:

JkMount /exodus/* exodus
JkUnMount  /images/* exodus


What the above lines do is this :
JkMount /exodus/* exodus

From the point of view of Apache httpd, mod_jk is a "content handler". That is, for Apache, it is mod_jk which generates the response that will be sent to the browser. When Apache receives a request (any request), it will pass it first to mod_jk. mod_jk then decides whether this is a URL for which it will generate the content itself, or not. If not, it returns a "declined" response to Apache. Apache then passes the same request to any other defined content handlers, which do the same thing. If all return "declined", then Apache uses its own default content handler to process this request.

JkMount tells mod_jk which request URLs it needs to process.
(of course mod_jk does not process these requests itself, it passes them to Tomcat for that, through the "worker" indicated in the same command. But Apache doesn't know that). JkUnMount is a list of exceptions. Basically it tells mod_jk "although we've told you to process all requests with URLs that match "/exodus/*", well, the ones that match "/exodus/images/*" are an exception, and for those ýou should return "declined" and let Apache handle them.

Note however that "/images/*" does not match "/exodus/*", so what you really meant may have been :
JkUnMount /exodus/images/* exodus


(and of course that would mean that you do have a subdirectory /exodus/images/ under your Apache DocumentRoot, with presumably images in it. If that is not the case, then just comment out this JkUnMount and let those images be served by Tomcat also. (Because then you presumably have a directory /usr/opt/tomcat/webapps/exodus/images. Do you ?)


> So, what is currently happening when I go to the site is that, the
> index.jsp page gets rendered as text. I have added index.jsp as a
> default page in httpd.conf but it says to me that apache is NOT speaking
> to tomcat properly in this configuration. Hopefully someone can put me
> straight on this. And sorry for all the info but again, I wanted to make
> sure that I had showed all that I had done.

That, I do not really understand. But hopefully with the above you should be getting one step further.


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

Reply via email to