Telesoft, Naples.
Hi. Mod_jk.so is a necessary library that allows the interation beetween Apache and Tomcat to use Servlets and JSPs technology, but i have seen that in the URLs' Open Source there aren't Binary Distribution of mod_jk.so for different platforms as SUN Solaris, Tru64 Unix and so. Moreover, the building of mod_jk.so is very difficultous: if you don't use a right process (directive, position, options) you always obtain an error in linking or in start of Apache or in test of Apache with the command: apachectl configtest. Ricoursive error are: a. compilation error or linking error Syntax error on line 202 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/mod_jk.so into server: ld.so.1: /usr/local /apache/bin/httpd: fatal: relocation error: file /usr/local/apache/libexec/mod_jk.so: symbol fdatasync: referenced symbol not found /usr/local/apache/bin/apachectl start: httpd could not be started gcc: -lposix4: linker input file unused since linking not done This error has obtained if you haven't include the right gcc include path. Remember that you must include also JDK include path! b. errors on start of Apache example: Syntax error on line 275 of /usr/local/apache/conf/httpd.conf: Can't find the workers file specified /usr/local/apache/bin/apachectl start: httpd could not be started This error has obtained if you haven't configuarete workers.properties in $APACHE_HOME/conf The errore of type a. are dependent by position of directive. I have also seen that the position of directive of compilation is critical, especially -DSOLARIS and -l posix4. Now I show you how do it, because i have done it in Telesoft (Naples, Italy) on Sun Solaris 2.6 platform. I suppose that you just have installed Apache, Tomcat, and JDK. My configuration is: Apache 1.3.14, Tomcat 4.0, JDK 1.4 1. You must verify that your Apache has got DOE's support with command: httpd -l. You must see mod_xxx is present. 2. You must install a Perl distribution 5.0 or higher I have installed nsperl (dynamic perl) 3. You must install gcc compiler 4. You must set corretly PATH, CLASSPATH, CATALINA_HOME, TOMCAT_HOME, JAVA_HOME In PATH there are: path of JDK bin path of gcc e cpp installed path of perl bin installed In CLASSPATH path of library di JDK (.JAR) In JAVA_HOME path of base JDK directory In CATALINA_HOME (so TOMCAT_HOME) path of base tomcat directory 5. You must change script apxs in $APACHE_HOME/bin You must insert nsperl before call apxs From: #!opt/local/bin/perl To: #!/usr/local/perl/nsPerl5.005_03/bin/nsperl because i have installed nsperl in /usr/local You must change the directive of apxs: From: require xxxx To: require 5.005_03 (it's obtained with: nsperl -v) From: my $CFG_LD_SHLIB = ld; my $CFG_LDFLAGS_SHLIB = -G; To: my $CFG_LD_SHLIB = q(ld); my $CFG_LDFLAGS_SHLIB = q(-G); my $CFG_PREFIX = '/usr/local/apache'; my $CFG_SBINDIR = '/usr/local/apache/bin'; my $CFG_CFLAGS = ''; my $CFG_LIBS_SHLIB = ''; my $CFG_LIBEXECDIR = '/usr/local/apache/libexec'; my $CFG_SYSCONFDIR = '/usr/local/apache/conf'; 5. You must install a source distribution of tomcat. In $CATALINA_HOME/src/native/apache1.3 there ar mod_jk.c and Makefile.x In $CATALINA_HOME/src/native/jk there are many c sources and file header (.h) I have prefered to create a my simple script build.sh, for a direct control, in $CATALINA_HOME/src/native/apache1.3 with this instruction: nsperl $APACHE_HOME/bin/apxs -o mod_jk.so -c -I /usr/java/include \ -I /usr/java/include/solaris -I ../jk \ -I /opt/GCC281/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1/include \ -DSOLARIS -l posix4 *.c ../jk/*.c Note that i also have introduct -I <path of gcc include > For simplicity i have copied *.o in ../jk/ and ricompiled, because obj must stay in ../jk for linking. I have obtained mod_jk.so without warnings, errors and i have copied in $APACHE_HOME/libexec. 6. Now you must create in $APACHE_HOME/conf workers.proprieties with this instructions # # workers.propertiers # # In Unix, we use forward slashes: ps=/ # list the workers by name worker.list=tomcat # -------------------------- # First tomcat server # -------------------------- worker.tomcat.port=8009 worker.tomcat.host=localhost worker.tomcat.type=ajp13 # #worker.tomcat.cachesize=ajp13 # # worker.tomcat.lbfactor=100 # # Load Balancer worker # # worker.loadbalancer.type=lb # worker.loadbalancer.balanced_workers=tomcat1,tomcat2 # END Then you must change httpd.conf with this instructions: LoadModule jk_module libexec/mod_jk.so AddModule mod_jk.c # # Configure mod_jk # JkWorkersFile /usr/local/apache/conf/workers.properties JkLogFile /usr/local/apache/logs/mod_jk.log JkLogLevel info Now you must do apachectl stop and apachectl start. If you apache is up, mod_jk is right! With Apache and two-three tomcat-istances is possible to do 'load balancing'. We also must install Cocoon for its XML support. To thank "Open Source" for its work and research, my company offers mod_jk.so in a tar distribution (mod_jk_solaris26.tar.gz) if will receive a simple e-mail to: [EMAIL PROTECTED] or [EMAIL PROTECTED] Best Regards.