• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Apache-Tomcat Connection

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

i am having a lot of trouble finding documents on integrating apache with tomcat. Here is what i have so far:

1) latest version of apache installed: http://www.mywebsite.com works and serves up whatever static html i have(such as index.html)

2) latest version of tomcat installed: http://www.mywebsite.com:8080/test/test.jsp works after i deployed test.war file to tomcat.

3) http://www.mywebsite.com/test/test.jsp does NOT work.

I understand i need to integrate tomcat with apache using something called mod_jk module and configure file changes. Here are my questions

1) to download the mod_jk(?) i went to this page: http://www.apache.org/dist/tomcat/to...nux/jk-1.2.14/

It has two files:
jakarta-tomcat-connectors-jk-1.2.14-linux-sles9-x86_64-prefork.so 29-Jul-2005 03:58 538K
jakarta-tomcat-connectors-jk-1.2.14-linux-sles9-x86_64-worker.so 29-Jul-2005 04:01 545K

Which one do i download? what's the difference? do i need both?

2) after i download the file to my linux box, where do i put it? do i need to rename it to something else?

3) what are the configure files i need to change, on the apache side? on the tomcat side?

any other steps to make this work? please list the steps and not just a link.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're correct in that you'll need mod_jk. As far as which one - there may or may not be a precompiled version for your platform. The ones you have listed look like they are for a 64 bit box which may or may not be correct.

I would strongly recommend building your own. The source can be downloaded from the Tomcat connectors site. Take a look at the build instructions and trust me when I say that they have improved drastically in the last several years.

Once you build it mod_jk.so will go to the same place other shared library plugins go, namely the modules directory. So if your Apache httpd is installed in /usr/local/apache2 mod_jk.so will go to /usr/local/apache2/modules. If you've used the standard config process the "make install" step will put it there for you.

On the Apache httpd side you will then have to decide which URL's are passed off to Tomcat. For each one of them you will need a JkMount directive. The documentation in this area is very good.

As part of your configuration on the Apache httpd side you will need to configure a workers.properties file. For simple things a simple one might be:



This, of course, will have to be modified to fit your needs.

If you use the standard server.xml that Tomcat comes with there are no changes needed on the Tomcat side.

Good luck!
 
S Dongan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

thank you for your reply. so ,i tried to compile mod_jk source and getting error message. I downloaded jakarta-tomcat-connectors-1.2.15-src.tar file and uploaded in the server

Logged in SSH terminal as a root and supplied the following commands to build

Step 1) export JAVA_HOME=/usr/java/j2sdk1.4.2_09
Step 2) export CATALINA_HOME=/opt/tomcat4/

Step 3) tar -xzvf jakarta-tomcat-connectors-1.2.14.1-src.tar.gz

step 4) cd jakarta-tomcat-connectors-1.2.14.1/jk/native

step 5) ./configure --with-axps=/usr/sbin/axps

at this stage, i am getting an error message

checking for vsnprintf... yes
checking for flock... yes
checking for setsockopt in -lsocket... no
checking whether to use SO_RCVTIMEO with setsockopt()... yes
checking whether to use SO_SNDTIMEO with setsockopt()... yes
no apxs given
checking for target platform... unix
no apache given


Do i have to supply any other arguments with configure command?

any help much appreciated.
[ April 28, 2006: Message edited by: S Dongan ]
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It appears that the path to axps is either incorrect or your Apache installation does not include axps. Can you make sure that /usr/sbin/axps exists? Also, is this Apache 1.3.x or 2.0.x? I've not built mod_jk for Apache 1.3.x for a while so I'm not sure if there are any issues there. Lastly, what O/S are you on?
 
reply
    Bookmark Topic Watch Topic
  • New Topic