Wrox Programmer Forums
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2004, 08:04 AM
Registered User
 
Join Date: Jul 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to eacostl
Default Compiling mod_jk2

Book: "Professional Apache Tomcat 5"
I am having significant trouble getting mod_jk2 to compile based on the book's instructions (p. 242). I am compiling it on a linux machine running SuSE 9.0
  - jakarta-tomcat-connectors-jk2-2.0.4-src
  - httpd-2.0.49
  - jakarta-tomcat-5.0.25 (binary download, as suggested in chapter 3)

I edited the jk/build.properties file and set "tomcat5.home=$CATALINA_HOME" and "apache2.home=/usr/local/apache2" (apache was compiled with dso).
$CATALINA_HOME is exported as /usr/local/java/tomcat in
/etc/profile.d/tomcat.sh
For reference, java is /usr/local/java/java

Running ant from the top-level connector directory repeatedly gives "BUILD FAILED
/usr/local/src/apache/jakarta-tomcat-connectors-jk2-2.0.4-src/build.xml:45:
Basedir /usr/local/src/apache/jakarta-tomcat-connectors-jk2-2.0.4-src/util does not exist"

I have tried creating that directory, but then it complains with another error.

I would love some help with this. I have been all over the internet trying to find out what is going on. This site (http://tinyurl.com/2d2we) seems somewhat helpful, but it seems to use an entirely different method than your book (which also did not work).

How can I make this connector work?

------
After asking the authors and researching extensively I found this solution. The main question I have, is why I call tomcat 5 as tomcat-41. The book talked about ant and this has nothing to do with ant.
APACHE2_HOME=/usr/local/apache2

cd jk/native2

./configure --with-apxs2=$APACHE2_HOME/bin/apxs --with-java-home=$JAVA_HOME --with-tomcat-41=$CATALINA_HOME --with-jni
cp ./jk/build/jk2/apache2/mod_jk2.so $APACHE2_HOME/modules
cp ./jk/build/jk2/apache2/libjkjni.so $APACHE2_HOME/modules

#
# edit httpd.conf
#
# LoadModule jk2_module modules/mod_jk2.so

 
Old August 23rd, 2004, 07:08 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Im very glad you posted this as Ive been struggling with the same issue. Im a novice and am a bit thrown by the detail you add for settings after ./config

My config failed because tomcat41 etc were not set properly, could you demonstrate the actual syntax.

Also you say this is nothing to do with ANT, does this mean I do not need to edit the build properties and run ant??

Are you saying I just need the correct settings for ./config??

Any help V much appreciated.

 
Old August 23rd, 2004, 07:20 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forgot to mention, binaries are available for Suse 9.0 at

http://apache.mirror.positive-intern.../jk2/binaries/

shame Im using Debian.

 
Old August 31st, 2004, 03:20 PM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If it's any consolation, I have spent the past couple of days trying to get jk2 connectors working on RedHat with similar results.

I get the same sort of missing jkini library errors in the JkMain start in my catalina.out, and when I try to build the missing jk2 library, I get a missing util directory error in the ant build. I am using Catalina 5.0.27 with Apache on Red Hat 7.3.

I have read that jk2 is improved, but is still perhaps not quite ready for prime time, at least as of the Tomcat FAQ (dated December, 2003) anyway:

http://jakarta.apache.org/tomcat/faq...ors.html#jkloc

I plan to go back and try mod_jk and/or possibly a Reverse Proxy (as mentioned in the preceding book link). I am personally leaning towards jk_mod at this point since it currently seems to be better integrated with the cpanel interface I am using.

Dave McLure


 
Old August 31st, 2004, 05:29 PM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh figures, just as I was about to give up on jk2 I realized that it is working after all and that the error messages I was seeing were related to having uncommented some unneeded lines in the jk2.properties file.

The main reason I thought it was broken was because I was getting 404 errors, but on closer inspection, I noticed that these 404 errors were coming from Tomcat (and not Apache). Once I figured out the correct URL to be specifying it began to work. I was thinking I needed to preface the URI with the "servlets/" subdirectory (as was once the case in days of old and is still the case in a lot of the documentation). As my contexts are already set up in the Apache httpd.conf, all I needed to do was specify the index.jsp I was looking to hit using the normal context URI as follows:

http://www.virtualsynthesis.net/index.jsp

..and voila! You can see the default index.jsp file which normally lives in the $CATALINA_HOME/webapps/ROOT/ subdirectory all mapped and connected - without having to specify the 8080 port anymore!

The only weird part was the fact that the images (tomcat.gif, etc.) were showing up missing, because Apache looks for them in the Apache web context for that virtual host. Once I copied all three images from the webapps/ROOT directory into the Apache web context's main "~/public_html/" directory, then everything worked fine.


 
Old September 1st, 2004, 10:42 AM
Registered User
 
Join Date: Jul 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to eacostl
Default

Angrycat:
Just put this into a shell script. I like to use a file called "go.sh" to compile my software, so I can remember what options I used 3 months down the road.
I don't think most of this is required, but your tomcat-41 maybe wasn't set because $CATALINA_HOME was not an environment variable. It needs to be set. I like to handle that with a script inside /etc/profile.d to set things up when I log in.

--script to compile mod_jk2--
APACHE2_HOME=/usr/local/apache2
CATALINA_HOME/path/to/tomcat
JAVA_HOME=/path/to/java

cd jk/native2

./configure --with-apxs2=$APACHE2_HOME/bin/apxs --with-java-home=$JAVA_HOME --with-tomcat-41=$CATALINA_HOME --with-jni
cp ./jk/build/jk2/apache2/mod_jk2.so $APACHE2_HOME/modules
cp ./jk/build/jk2/apache2/libjkjni.so $APACHE2_HOME/modules


echo "Now edit httpd.conf"
echo "Add: LoadModule jk2_module modules/mod_jk2.so"

 
Old September 7th, 2004, 05:12 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Thanks a lot for the reply, got an error saying that apxs2 could not be found, that file was not on my system so i used apxs instead, is this likely to cause a problem?

I am getting a number of errors for tomcat33, 40 and 41 locations not being provided, also an error with the jdk location, for which I am sure the path is set correctly, i can run java ok from the prompt.

Are these the result of using apxs, or is there another problem??

Thanks,

 
Old September 7th, 2004, 05:23 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello again,

Had another look at this, the first error is "no apxs2 given", ive just been looking for a download and cannot find one, where would I get this??

Thanks,

 
Old September 7th, 2004, 05:42 PM
Registered User
 
Join Date: Jul 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to eacostl
Default

You've got to compile apache with Shared Object support. That's what allows modules to be added and removed after the initial compilation has finished.

I believe the apache configure command involves
--enable-so

 
Old September 7th, 2004, 07:33 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,

I tried re configuring apache with ./configure --enable-so, it seemed to compile ok, but I still get the same error when working with jk2, do you think this is because of bad apache configuration then?








Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_jk2 error in apache logs psimoneschi Apache Tomcat 0 September 12th, 2007 12:11 PM
help with compiling mastrgamr C++ Programming 5 November 13th, 2006 08:04 AM
Generate mod_jk2 WXP Xavi Apache Tomcat 0 April 7th, 2005 03:22 PM
Clustering Apache 2 & Tomcat 5 with mod_jk2 blaufenberg BOOK: Professional Apache Tomcat 0 November 23rd, 2004 06:23 PM
Configuring Apache + Tomcat using mod_jk2 gnseg BOOK: Professional Apache Tomcat 2 November 23rd, 2004 06:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.