You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aman Arora <am...@gmail.com> on 2012/05/25 07:25:33 UTC

mod_jk not working !!

 m trying to do a setup of tomcat clustering in which one tomcat is on port
8080 and other one is on 8081.
i have downloaded the tomcat-connector in the modules folder of my apache.i
built it using build-unix.sh by downloading the script from net as it was
nt already there in the downloaded tomcat-connector. it buit mod_jk.so
which i have placed inside modules folder as
/usr/local/apache2/modules/mod_jk.so
then i created workers.properties file and gave the description of workers
there .and included it in httpd.cong file .
still when i type http://localhost/jsp-pages which are in my webapps / it
is not passing requast to tomcat which is holding the js pages.
you may hav a look at the conf files to get a better fel of the problem !
the link is
http://www.coderanch.com/t/581294/Tomcat/Tomcat-Clustering#2648034

Re: mod_jk not working !!

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 5/25/12 12:26 PM, Mark Eggers wrote:
> . . . just my three cents (since this is long)

More like twelve bucks: you should send this guy a bill for the
message you just put together for him.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+/tT4ACgkQ9CaO5/Lv0PDYhQCcDgYU8IJzIwqd0toPoJPk+UMK
5lEAoJbcKTc3l4wl9UWBLyOVd9qhaczv
=Ly2T
-----END PGP SIGNATURE-----

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


Re: mod_jk not working !!

Posted by Aman Arora <am...@gmail.com>.
Dear All,


 Thanks for your suggestions and your valuable time...
next time i post questions,i ll take care of the proper things .
i ll try to work on your suggestions and then come back to you people .

Thanks
Aman Arora

>
>

Re: mod_jk not working !!

Posted by Pid * <pi...@pidster.com>.
On 25 May 2012, at 19:21, Mark Eggers <it...@yahoo.com> wrote:

>> ________________________________
>> From: Christopher Schultz <ch...@christopherschultz.net>
>> To: Tomcat Users List <us...@tomcat.apache.org>
>> Sent: Friday, May 25, 2012 9:57 AM
>> Subject: Re: mod_jk not working !!
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Chuck,
>>
>> On 5/25/12 12:41 PM, Caldarale, Charles R wrote:
>>>> From: Mark Eggers [mailto:its_toasted@yahoo.com] Subject: Re:
>>>> mod_jk not working !!
>>>
>>>
>>>> I'll try to give a few general directions.
>>>
>>> <much useful content snipped>
>>>
>>>> Again, start simply.
>>>
>>>> 1. Stock Apache HTTPD installation (and verify) 2. Stock Apache
>>>> Tomcat installation (and verify) 3. mod_jk installation (and
>>>> verify) 4. Second Apache Tomcat installation (and verify both) 5.
>>>> Cluster
>>>
>>> I'd suggest that your entire e-mail should be put in the Wiki.
>>
>> +1, though maybe in smaller pieces linked by a top-level page.
>>
>> - -chris
>
>
> If this goes up on the Wiki, then smaller pages organized by task would be good.
>
> It would probably help if the Wiki pages had a lot of detail, and cross-reference the appropriate documentation on the Tomcat web site as well.
>
> I've been meaning to write this up for some time, so maybe I'll get started on it this weekend.
>
> Since this is going to take a bit of time, is there a place on the Tomcat Wiki that I can write but not have it published (may be a developer list question). If not, then I'll write locally and then do a cut / paste. However, it would be nice to have feedback during the writing process.

It's coherent. Just put it up, worry about the tweaking later.


p



>
> /mde/
>
> ---------------------------------------------------------------------
> 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: mod_jk not working !!

Posted by Mark Eggers <it...@yahoo.com>.
>________________________________
> From: Christopher Schultz <ch...@christopherschultz.net>
>To: Tomcat Users List <us...@tomcat.apache.org> 
>Sent: Friday, May 25, 2012 9:57 AM
>Subject: Re: mod_jk not working !!
> 
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Chuck,
>
>On 5/25/12 12:41 PM, Caldarale, Charles R wrote:
>>> From: Mark Eggers [mailto:its_toasted@yahoo.com] Subject: Re:
>>> mod_jk not working !!
>> 
>> 
>>> I'll try to give a few general directions.
>> 
>> <much useful content snipped>
>> 
>>> Again, start simply.
>> 
>>> 1. Stock Apache HTTPD installation (and verify) 2. Stock Apache
>>> Tomcat installation (and verify) 3. mod_jk installation (and
>>> verify) 4. Second Apache Tomcat installation (and verify both) 5.
>>> Cluster
>> 
>> I'd suggest that your entire e-mail should be put in the Wiki.
>
>+1, though maybe in smaller pieces linked by a top-level page.
>
>- -chris


If this goes up on the Wiki, then smaller pages organized by task would be good.

It would probably help if the Wiki pages had a lot of detail, and cross-reference the appropriate documentation on the Tomcat web site as well.

I've been meaning to write this up for some time, so maybe I'll get started on it this weekend.

Since this is going to take a bit of time, is there a place on the Tomcat Wiki that I can write but not have it published (may be a developer list question). If not, then I'll write locally and then do a cut / paste. However, it would be nice to have feedback during the writing process.

/mde/

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


Re: mod_jk not working !!

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 5/25/12 12:41 PM, Caldarale, Charles R wrote:
>> From: Mark Eggers [mailto:its_toasted@yahoo.com] Subject: Re:
>> mod_jk not working !!
> 
> 
>> I'll try to give a few general directions.
> 
> <much useful content snipped>
> 
>> Again, start simply.
> 
>> 1. Stock Apache HTTPD installation (and verify) 2. Stock Apache
>> Tomcat installation (and verify) 3. mod_jk installation (and
>> verify) 4. Second Apache Tomcat installation (and verify both) 5.
>> Cluster
> 
> I'd suggest that your entire e-mail should be put in the Wiki.

+1, though maybe in smaller pieces linked by a top-level page.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+/ufQACgkQ9CaO5/Lv0PBvzQCeM/ugajKLsv3od//91wc3WcKP
/X4AoJztvRXa1d6lMYdHSbPiiT5WDPIF
=nBVy
-----END PGP SIGNATURE-----

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


RE: mod_jk not working !!

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mark Eggers [mailto:its_toasted@yahoo.com] 
> Subject: Re: mod_jk not working !!


> I'll try to give a few general directions.

<much useful content snipped>

> Again, start simply.

> 1. Stock Apache HTTPD installation (and verify)
> 2. Stock Apache Tomcat installation (and verify)
> 3. mod_jk installation (and verify)
> 4. Second Apache Tomcat installation (and verify both)
> 5. Cluster

I'd suggest that your entire e-mail should be put in the Wiki.

 - 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: mod_jk not working !!

Posted by Mark Eggers <it...@yahoo.com>.
>________________________________
> From: Aman Arora <am...@gmail.com>
>To: users@tomcat.apache.org
>Sent: Thursday, May 24, 2012 10:25 PM
>Subject: mod_jk not working !!
> 
>m trying to do a setup of tomcat clustering in which one tomcat is on port
>8080 and other one is on 8081.
>i have downloaded the tomcat-connector in the modules folder of my apache.i
>built it using build-unix.sh by downloading the script from net as it was
>nt already there in the downloaded tomcat-connector. it buit mod_jk.so
>which i have placed inside modules folder as
>/usr/local/apache2/modules/mod_jk.so
>then i created workers.properties file and gave the description of workers
>there .and included it in httpd.cong file .
>still when i type http://localhost/jsp-pages which are in my webapps / it
>is not passing requast to tomcat which is holding the js pages.
>you may hav a look at the conf files to get a better fel of the problem !
>the link is
>http://www.coderanch.com/t/581294/Tomcat/Tomcat-Clustering#2648034

OK,

I've taken a brief look at your configuration files (httpd.conf, mod_jk.conf, server.xml, workers.properties).

I've also taken a brief look at the Safari Books link you gave.

As Andre said (sorry about the lack of accent, Andre), people are going to be a bit reluctant to wade through all of that material and provide pointers.


Also as Andre has said, clustering Tomcat on the same machine works fine for many people. I routinely use a 3 or 4 node cluster as a test platform.

I'll try to give a few general directions. As is my usual practice, this is going to be long. You have been warned.

General thoughts
================

In your Code Ranch postings, you state that you are new to Linux. Getting clustering to work on Linux involves Apache HTTPD configuration, Tomcat configuration, and Linux configuration. If this is your first time doing all of this, it's probably best to get a simple mod_jk connection working first.

At each stage of the setup, I recommend testing and coming back to the mailing list with simple questions and the relevant portion(s) of the configuration file(s). Also, be prepared to do at least as much work as those people trying to help. Remember, this is a volunteer list, and we contribute in our spare time.

Also, as another aside . . . there is a lot of misleading, incomplete, and just flat wrong information concerning Tomcat floating around on the 'net. The authoritative source for information is always:

http://tomcat.apache.org/


The mailing list for questions is this mailing list. We try to give accurate information, and some people here have been working with Tomcat for a very long time.

You might get accurate information elsewhere, but from what I've seen this is not very likely.

Linux in General
================

You'll find that Linux is a different beast than Windows (even Windows 7). In particular file permissions, file ownerships, and SELinux present quite a different security model than the typical Windows installation. It's best to be aware of this from the start.

Purpose
=======

What is the purpose of this setup? If you're running a pseudo-production development platform, then what you're setting up may be reasonable. If you're setting up a development platform with NetBeans or Eclipse, then you will run into a lot of file access problems with your setup.

If you're setting up a development system, I recommend just creating a directory in your home directory to hold a single Tomcat, unpack Tomcat 7.0.27 in that directory, edit $CATALINA_HOME/conf/tomcat-users.xml per the instructions, and then use that installation.

http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Configuring_Manager_Application_Access 


Once it's running and you can access the manager application, then associate the installation with your IDE. Now you can develop, debug, test, and deploy without running into permission issues.

If you're setting up a pseudo-production environment, then it's probably a good idea to set up a service account, install (and control) all Tomcats from that account, and connect those Tomcats to Apache HTTPD (or not). Note that since this is a separate account, this is a bit less convenient for development.

Apache HTTPD
============

I noticed that you have a lot of /usr/local based directories in your Apache HTTPD configuration. This is quite unusual for Linux, since most (all?) Linux distributions package Apache HTTPD.

Rather than building your own Apache HTTPD, I recommend that you get and install the distribution package for Apache HTTPD. This will place files in line with the rest of your system, and it will also have a serviceable default configuration.

On Fedora, the Apache HTTPD packages include:

apr
apr-util
apr-devel
apr-util-devel
httpd
httpd-devel
httpd-tools

The -devel packages are very important, since you will be building mod_jk from source.

Java
====

I from your messages that you have Oracle's Java installed. Make sure you're using the Java you think you're using. Type:

javac -version
java -version

on the command line and see what you get.

Tomcat
======

As I've noted above if you're setting up a pure development environment it's just best to create a directory in your home directory and unpack a Tomcat there. For now, just start with one.

If you have Java installed correctly, Tomcat comes ready to run out of the box. Just unpack it, cd to the bin directory, and run startup.sh. You should be able to browse to localhost:8080/ and see the Tomcat welcome page.

Unlike Apache HTTPD, most people here do NOT recommend that you use the Linux distribution packaged versions of Tomcat. In general people have found that these are much more difficult to work with than just getting a stock Tomcat from:

http://tomcat.apache.org/ 


mod_jk build
============

While other people have had difficulty (search the mailing list) building mod_jk on various platforms, I've never had much trouble.

1. Download the source from http://tomcat.apache.org/
2. Unpack it into a directory
3. cd to [tomcat-connectors-1.xx]/native
4. Read BUILDING.txt

Briefly . . .
1.  ./configure --with-apxs=/usr/sbin/apxs
2. make
3. su to root
4. cd back to where you were
5. make install

This will put everything in the right place.

mod_jk configuration
====================

Recent versions of mod_jk come with some very nice and well-commented examples. They can be found in [tomcat-connectors-1.xx]/conf. Read them, follow them, use them.

The defaults have been chosen to work in most general use cases.

Map all of the examples (not just the *.jsp files).

Restart Apache HTTPD, and then start Apache Tomcat. You should be able to browse to localhost/examples and get the Apache Tomcat examples.

---- IMPORTANT ----

Do not proceed with clustering until this works.

---- IMPORTANT ---- 


Please note that if you place all of your mappings in a uriworkermap.properties file, Apache HTTPD will reread this once per minute (by default). This is nice if you tend to add and delete Tomcat applications. It's probably not quite as nice for a production system (but I don't know what the overhead is).

Clustering
==========

There are a lot of pieces.

1. Linux

You have to ensure that multicast is enabled, and that multicast routing is set up. If you run iptables, you may run into firewall issues, but on the same system probably not.

I'll not go into the Linux configuration issues in detail at this time.

2. mod_jk

You'll have to add another host (obviously) for clustering. You'll need to name your workers appropriately. As noted in the documentation, each worker name must match the jvmRoute attribute set in your Engine.

http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html#Cluster_Basics 


You'll need to change the mapping in uriworkermap.properties to point to the load balancer.

3. Another Tomcat

While the easiest way to get started with clustering is just to unpack another copy of Tomcat in another directory, it's probably far more useful to use the concept of CATALINA_HOME and CATALINA_BASE. See RUNNING.txt in the Tomcat directory for details.

4. Tomcat clustering configuration

The basic clustering documentation can be found here:

http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html 


It's long, involved, and needs to be read carefully. However, as a first pass the following will work.

a. Make sure that each Tomcat has a unique jvmRoute in the
   Engine element
b. Make sure that the jvmRoute matches the correct worker
   name (see above)
c. Make sure that each Tomcat has a unique shutdown port
d. Make sure that each Tomcat has a unique AJP/1.3 port
e. Make sure that each AJP/1.3 port matches the correctly
   named worker in  workers.properties
f. Make sure that each HTTP/1.1 port is unique (nice for
   manager access)
g. Copy the example configuration from:

http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html

to inside your Host element in server.xml, but omit (for now) the Deployer element.

Start up your Tomcat servers.

It's also nice to have the access log enabled for your Tomcat servers. You can then tell which Tomcat is receiving the request from Apache HTTPD.

==============

This above should point you in the right direction.

Again, start simply.

1. Stock Apache HTTPD installation (and verify)
2. Stock Apache Tomcat installation (and verify)
3. mod_jk installation (and verify)
4. Second Apache Tomcat installation (and verify both)
5. Cluster

. . . just my three cents (since this is long)
/mde/


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


Re: mod_jk not working !!

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aman,

On 5/25/12 1:25 AM, Aman Arora wrote:
> I'm trying to do a setup of tomcat clustering in which one tomcat
> is on port 8080 and other one is on 8081.

Sounds reasonable.

> i have downloaded the tomcat-connector in the modules folder of my
> apache.i built it using build-unix.sh by downloading the script
> from net as it was nt already there in the downloaded
> tomcat-connector.

What is build-unix.sh and why did you have to "download it from [the]
net"? Other than apxs (which implies you have the httpd dev tools
available), you don't need anything else to build mod_jk for your
environment. Read the README.txt file in the root of the tarball and
follow the directions.

> it buit mod_jk.so

That's good. Since I don't know what build-unix.sh does, I'm happy it
didn't delete your kernel.

> which i have placed inside modules folder as 
> /usr/local/apache2/modules/mod_jk.so then i created
> workers.properties file and gave the description of workers there

What's in there (see below)?

> .and included it in httpd.cong file .

How?

> still when i type http://localhost/jsp-pages which are in my
> webapps / it is not passing requast to tomcat which is holding the
> js pages.

What do you get in the response instead?

> you may hav a look at the conf files to get a better fel of the
> problem ! the link is 
> http://www.coderanch.com/t/581294/Tomcat/Tomcat-Clustering#2648034

So I have to follow one link to get to 4 other links?

For those less-willing to put up with this kind of crap, here's the
important part of httpd.conf:

Include /usr/local/apache2/conf/mod_jk.conf

(*Not inside a VirtualHost definition*)

Here's the mod_jk.conf:

    LoadModule jk_module /usr/local/apache2/modules/mod_jk.so
    JkWorkersFile /usr/local/apache2/conf/workers.properties
    JkLogFile /usr/local/apache2/logs/mod_jk.log
    JkLogLevel info
    #JkMount /sample/* loadbalancer
    #JkMount /* loadbalancer
    JkMount /examples/*.jsp default

And finally, here's the workers.properties:

    workers.tomcat_home=/usr/local/tomcat/apache-tomcat-7.0.27/
    workers.java_home=/usr/java/jdk1.7.0_04/
    ps=/
    worker.list=tomcatnode1, tomcatnode2, loadbalancer
    worker.tomcatnode1.port=8009
    worker.tomcatnode1.host=localhost
    worker.tomcatnode1.type=ajp13
    worker.tomcatnode1.lbfactor=1
    worker.tomcatnode2.port=8010
    worker.tomcatnode2.host=localhost
    worker.tomcatnode2.type=ajp13
    worker.tomcatnode2.lbfactor=1
    worker.loadbalancer.type=lb
    worker.loadbalancer.balanced_workers=tomcatnode1, tomcatnode2
    worker.loadbalancer.sticky_session=1


So, I can see a bunch of problems. Let's start at the top.

1. You put your JkMount directives in your mod_jk.conf file,
   which is included in your the top-level httpd.conf file.
   Your JkMounts will not be copied into your VirtualHosts
   and so you essentially have no mappings at all.

2. You are mapping /examples/*.jsp and trying to access /jsp-pages,
   so that's not going to work.

3. You are mapping /examples/*.jsp to the "default" worker, which
   has not been defined.

4. You have an old mod_jk config that contains these irrelevant
   settings: workers.tomcat_home, workers.java_home, ps

5. You have defined your 2 "node" workers to be on ports 8009 and 8010
   but you said that you have your Tomcats running on 8080 and 8081.
   Perhaps you have AJP/1.3 connectors defined for 8009 and 8010 but
   I'm not going to enter /yet another/ CAPTCHA just to see your
   configuration files which I'm sure are completely full of comments
   and other crap I don't feel like reading.

I suspect that #1, #2, and #3 are your real problems. Fix those and
try again.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+/tQIACgkQ9CaO5/Lv0PAqXQCeLCHjYQAtRJH8FQ78+x9e0xf4
v1gAoJLdYNCS/HErJbQr2bm47AUYSczC
=y+SX
-----END PGP SIGNATURE-----

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


Re: mod_jk not working !!

Posted by André Warnier <aw...@ice-sa.com>.
That's strange.  It's working fine for many other people, on thousands of websites.

Maybe it is your configuration that is not working ?

"xxxx is not working !!" is about the best subject that can be imagined, if your intention 
was to not get any response at all.  The only missing parts are capitals and the word 
"URGENT".

And if you believe that anyone is going to walk through the hundreds of lines of your 
configuration files, trying to figure out what you did wrong, then you have a surprise coming.

You really need to read this : http://www.catb.org/~esr/faqs/smart-questions.html

When you have read it, post another message to the list, with a better subject and the 
/relevant/ parts of your configuration, and maybe someone will feel like helping.




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