Do not despair.

If you have removed the Alias line, it is totally normal that your first link does not work. That's because in your case that link is *supposed* to be served by Apache, but there is no file to serve at
/usr/java/tomcat-5.5/webapps/servlets-examples/servlet/HelloWorldExample
(and anyway, leave that Alias line out. It is not good, for reasons I will give you later).

The problem is only why it does not pass the
/ex/servlet/HelloWorldExample
to Tomcat

So, let's start from the beginning.
Follow these steps, and stop whenever it does not give the expected answer.

1) verify that Tomcat, by itself, is started and listening :
Your Tomcat should have a HTTP connector (probably at port 8180)
You should check in the server.xml file of Tomcat.
It should look approximately like this :
   <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8180" minProcessors="5" maxProcessors="75"
               enableLookups="true" acceptCount="10" debug="0"
               connectionTimeout="20000" useURIValidationHack="false" />
(Look at the "port=xxxx"), and whenever you see "xxxx" below, replace it by that port number. If this connector is not activated (commented out), activate it, we will need it for the tests below. Restart Tomcat if necessary.

You can check if Tomcat is listening on that port with netstat :
netstat -an | grep xxxx   (where xxxx is the port number above)
You should see a line ending in "LISTEN".

2) Try to acces that HTTP connector (from your browser) with :
http://www.jaatmusic.com:xxxx
(where xxxx is the same port above)
You should get some standard Tomcat Welcome page.

3) Now try
http://www.jaatmusic.com:xxxx/examples
You should see the examples menu page

4) then, on that same page, click the link for the HelloWorld example.
Does it run the HelloWorld servlet ?

If yes, then go back to the menu page, and hover with the cursor above the "HellowWorld" example link, and note the exact URL that it shows for that link (at the bottom of your browser page).
It should be something like :
http://www.jaatmusic.com:xxxx/examples/HelloWorld
(It is important to make sure of that, because that is the URL that Tomcat expects to run the example, even later when we will go through the mod_jk connector)

5) check if Tomcat is listening *also* on the port of your AJP connector
netstat -an | grep 8009
Do you also see a "LISTEN" line ?
(I am sure it is, because I can see it from outside. You will probably need to do someting about that later).

6) try to connect to that port with telnet :
telnet www.jaatmusic.com 8009
Do you get a connection ?
(if yes, try to type something, and then close the connection. Your Tomcat logs should now show something, even if it is garbage).
(something like :
2008-07-21 00:29:44 Ajp13Processor[8010][5] [Ajp13] incomplete read, waited #-1 got only 0
)

If all the above is ok, then Tomcat should be fine, and we can go back and check the Apache side.

7) replace your JkMount line in Apache by these 2 lines :
JkMount /examples testWorker
JkMount /examples/* testWorker
and restart Apache

8) enter
http://www.jaatmusic.com/examples
(notice that this time you are *not* entering the port xxxx, because you want to connect through Apache, not go directly to Tomcat).
Do you see the same Tomcat examples menu page as before ?
If not, what do you see ? an error page of Apache, or one of Tomcat ?

André



Ravi Sharma wrote:
ya thats true propblems gives u more knowledge..but this one is killing me
:)
i have removed the alias line too..... now none of the link is working....
:(
I dont know whats wrong

now httpd.conf has only this line

JkMount /ex/servlet/HelloWorldExample testWorker.

I really dont know what i am missing.......
please help.

On Sun, Jul 20, 2008 at 2:44 PM, André Warnier <[EMAIL PROTECTED]> wrote:

The good news is that you will learn more by encountering problems and
solving them, than if everything worked correctly on the first pass.

Ravi Sharma wrote:
[...]

 Alias /ex /usr/java/tomcat-5.5/webapps/servlets-examples
JkMount /ex/servlet/* testWorker

I think that the two lines above conflict with eachother :

First you are telling Apache that if it sees "/ex" in a URI, it should
translate it to "/usr/java/tomcat-5.5/webapps/servlets-examples".
Then you are telling Apache that if it sees a URI like "/ex/servlet/*", it
should pass it to mod_jk (which will pass it to Tomcat).

Here is my guess as to what happens, step by step :

You send the following request to Apache :
/ex/servlet/HelloWorldExample

Because of the "Alias", Apache will first translate this to the file
location
/usr/java/tomcat-5.5/webapps/servlets-examples/HelloWorldExample

Then Apache will try to find a "handler" for that location.
Because mod_jk is installed, Apache will ask mod_jk if it is interested in
this URI.

mod_jk will say no, because the above translated URI does not match
"/ex/servlet/*" in the JkMount.  So mod_jk will return "DECLINED" to Apache.

Then Apache will ask other possible handlers, and if nobody else wants this
URI, then Apache will select its own default handler (the one which just
returns local files).

This default handler will try to find the file
/usr/java/tomcat-5.5/webapps/servlets-examples/HelloWorldExample
and will not find it. So it will return an error.

The point is that an "Alias" happens earlier in the cycle of processing the
request (the "URI translation" step), and the "content generation" step
happens later.  mod_jk (and Tomcat) are involved in the "content-generation"
phase.  But by the time mod_jk is getting asked if it wants to generate the
content, the URI is already tanslated, and mod_jk does not recognise it.

In short, for a test of the above, comment out the "Alias" line, restart
Apache, and try again the URL
http://www.jaatmusic.com/ex/servlet/HelloWorldExample

Of course, with the above change, your first URL
http://www.jaatmusic.com/ex
will probably not work anymore, but that is normal and we will see that
next.


For a bit more more information on the order in which the various request
processing steps happen in Apache, read through this :
http://httpd.apache.org/docs/2.2/developer/request.html
For the same with pictures, try this :
http://www.apachetutor.org/dev/request


André



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





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

Reply via email to