hints on using Tomcat connector on AIX
mod_jk and Apache 1.3 with gcc
software used for this build
GNU make is definitely required. The connector fails to build with native AIX make, so make absolutely sure that GNU make is found in PATH prior to /usr/bin/make.
building Apache 1.3
Build Apache as described here.building mod_jk
$ cd jakarta-tomcat-connectors-jk-1.2.2-src/jk/native$ ./buildconf.sh$ ./configure --with-apxs=$HOME/1327_gcc/bin/apxs --with-java-home=/usr/java131Before running make, you need to edit apache-1.3/Makefile and update it for AIX. Replace this section:
## Compile part.#mod_jk.la: mod_jk.lo $(APACHE_OBJECTS) ${MOD_LINK} -o $@ -module -rpath ${libexecdir} $^with this, using your own Apache install path for the location of httpd.exp:
## Compile part.#mod_jk.la: mod_jk.lo $(APACHE_OBJECTS) ${MOD_LINK} -o $@ -Wl,-bI:/home/trawick/1327_gcc/libexec/httpd.exp -module -rpath ${libexecdir} $^Now we can really build:
$ gmakeYou may just hit this obscure error during make if you originally configured libtool using IBM's C compiler for AIX:
Waiting for jk_ajp12_worker.o.lock to be removed.The work-around is to edit libtool (whichever one is found in PATH) and change the setting of the variable
need_locks
to "warn"
, then run make again. Here is the section in the libtool script: # Must we lock files when doing compilation ?need_locks="yes"need_locks="warn"After make completes, the DSO is in the unlikely location
apache-1.3/.libs/libmod_jk.so.0
. Install it manually instead of using make install
: $ cp -p apache-1.3/.libs/libmod_jk.so.0 /home/trawick/1327_gcc/libexec/mod_jk.soand add these lines to httpd.conf:
LoadModule jk_module libexec/mod_jk.so...AddModule mod_jk.c(You don't need the
AddModule
directive unless you put the LoadModule after ClearModuleList... check out the docs at httpd.apache.org.) mod_jk and Apache 1.3 with gcc (alternate)
software used for this build
GNU make is definitely required. The connector fails to build with native AIX make, so make absolutely sure that GNU make is found in PATH prior to /usr/bin/make.
building Apache 1.3
Build Apache as described here. For this example, we'll assume that you installed it into$HOME/1328_gcc
. building mod_jk
$ cd jakarta-tomcat-connectors-4.0.6-src/jk/native$ ./buildconf.sh$ ./configure --with-apxs=$HOME/1328_gcc/bin/apxs --with-java-home=/usr/java131Before running make, you need to edit apache-1.3/Makefile and update it for AIX. Replace this section:
## Compile part.#mod_jk.la: mod_jk.lo $(APACHE_OBJECTS) ${MOD_LINK} -o $@ -module -rpath ${libexecdir} $^with this, using your own Apache install path for the location of httpd.exp:
## Compile part.#mod_jk.la: mod_jk.lo $(APACHE_OBJECTS) ${MOD_LINK} -o $@ -Wl,-bI:/home/trawick/1327_gcc/libexec/httpd.exp -module -rpath ${libexecdir} $^Now we can really build:
$ gmakeYou may just hit this obscure error during make if you originally configured libtool using IBM's C compiler for AIX:
Waiting for jk_ajp12_worker.o.lock to be removed.The work-around is to edit libtool (whichever one is found in PATH) and change the setting of the variable
need_locks
to "warn"
, then run make again. Here is the section in the libtool script: # Must we lock files when doing compilation ?need_locks="yes"need_locks="warn"After make completes, the DSO is in the unlikely location
apache-1.3/.libs/libmod_jk.so.0
. Install it manually instead of using make install
: $ cp -p apache-1.3/.libs/libmod_jk.so.0 /home/trawick/1327_gcc/libexec/mod_jk.soand add these lines to httpd.conf:
LoadModule jk_module libexec/mod_jk.so...AddModule mod_jk.c(You don't need the
AddModule
directive unless you put the LoadModule after ClearModuleList... check out the docs at httpd.apache.org.) mod_jk2 and Apache 2.0 with IBM's native compiler for AIX
Existing tarballs like jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz have syntax errors that prevent compiling the code with the native AIX compiler. We'll check out the most recent sources from CVS and apply a minimal patch and be sure to use the unpicky compiler flavor so that we don't have any unnecessary grief.If you downloaded from CVS prior to 20030403, or you use a tarball built prior to 20030403, then make sure you have downloaded this patch file since it is needed for the build.
If you are using Apache 2.0.45, make sure you specified --enable-so
on the configure invocation, since that works around a bug in 2.0.45 that broke DSOs.
Other software needed:
gmake
/opt/freeware/bin/patch
So do this to grab the sources.
$ CVSROOT=:pserver:anoncvs@cvs.apache.org:/home/cvspublic cvs login(enter "anoncvs" for the password)$ CVSROOT=:pserver:anoncvs@cvs.apache.org:/home/cvspublic cvs co jakarta-tomcat-connectorsAt this point, we have the sources checked out. Change into the directory for mod_jk2, apply my patch file if using connector code older than 20030403, possibly edit server/apache2/Makefile.in, and build the configure script. If the patch fails to apply, it maybe that mod_jk2 is fixed in CVS already, or it may be that there are other changes to the code that needed to be patched.
$ cd jakarta-tomcat-connectors/jk/native2# If using connector code from prior to 20030403, apply this patch:$ /opt/freeware/bin/patch < jk2_cc_patch_20030313# If using Apache older than 2.0.45, edit this line in# jk/native2/server/apache2/Makefile.in and change "-lapr-0" to "-lapr".# JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt -lapr-0 @PCRE_LIBS@$ ./buildconf.shlibtoolize --force --automake --copyaclocalautomake --copy --add-missingautomake: configure.in: installing `scripts/build/unix/install-sh'automake: configure.in: installing `scripts/build/unix/mkinstalldirs'automake: configure.in: installing `scripts/build/unix/missing'autoconfNow, run configure to customize the build for your machine. Adjust the --with-java-home and --with-apxs2 configure parameters shown below to point to your own java install and the apxs file from your Apache 2.0 installation.
Note that even if you used xlc_r for compiling Apache, you'll need to use CC=cc_r instead of CC=xlc_r when configuring the connector because the connector has various signed-ness problems with character strings which xlc_r will treat as compile failures.
$ CC=cc_r ./configure --with-java-home=/usr/java131 --with-apxs2=/jeff/trawick/apacheinst/bin/apxs[lots of output not shown]Now run GNU make to build it (the make files are not compatible with native AIX make).
$ gmake[lots of output not shown]If the build fails with a message like this:
ld: 0706-006 Cannot find or open library file: -l apr-0 ld:open(): No such file or directorythen you forgot to edit server/apache2/Makefile.in (see above).
Now, manually grab the mod_jk2 DSO and rename it to something sane while copying it to the Apache modules directory. Because of libtool &^%$#@, on AIX it will be called libmod_jk2.so
after the make completes.
$ cd ../../jk/build/jk2/apache2$ cp -p libmod_jk2.so /jeff/trawick/apacheinst/modules/mod_jk2.soAdd the appropriate LoadModule to Apache 2's configuration file and away you go.
Apache httpd 2.0.46, gcc, mod_jk2 from Tomcat 4.0.6
Source distributions I used:httpd-2.0.46.tar.gzjakarta-tomcat-connectors-4.1.24-src.tar.gzSupport utilities I used:
AIX 5.1 ML 02java 1.3.1IBM's RPM install of GCC gcc (gcc-2.9.aix51.020209-3)GNU libtool 1.4.2 installed from sourceIBM's RPM install of GNU autoconf (autoconf-2.53-1)GNU automake 1.5 installed from sourceIBM's RPM install of GNU make (make-3.79.1-3)I can't say definitively that those levels have to be used beyond the fact that this level of mod_jk2 fails to build with java < 1.3.1.
In the examples below, /home/trawick/gcc_httpd_mod_jk2 is where I unpacked the source distributions and /home/trawick/gcc_httpd_mod_jk2/install is where I installed Apache. You'll need to adjust that, and perhaps other local customizations, as appropriate for your environment.
building Apache
If using Apache httpd >= 2.0.47, setting CPPFLAGS as shown in the example is not required.If using Apache httpd 2.0.45, add "--enable-so" to your configure invocation.
Don't try it with older Apache httpd since apxs is broken on AIX until 2.0.45. Also, the Tomcat build relies on an APR rename that happened with 2.0.45.
$ cd /home/trawick/gcc_httpd_mod_jk2$ gtar -xzf httpd-2.0.46.tar.gz$ cd httpd-2.0.46$ ./buildconf$ CPPFLAGS=-D_THREAD_SAFE CC=gcc ./configure --prefix=/home/trawick/gcc_httpd_mod_jk2/install --enable-mods-shared=most --with-expat=$PWD/srclib/apr-util/xml/expat$ make$ make install
building mod_jk2
$ cd /home/trawick/gcc_httpd_mod_jk2$ gtar -xzf jakarta-tomcat-connectors-4.1.24-src.tar.gz$ cd jakarta-tomcat-connectors-4.1.24-src$ cd jk/native2$ chmod +x ./buildconf.sh$ ./buildconf.sh$ CC=gcc ./configure --with-java-home=/usr/java131 --with-apxs2=/home/trawick/gcc_httpd_mod_jk2/install/bin/apxsBefore running make, edit ../../jk/native2/server/apache2/Makefile and change the line
MOD_LINK = $(LIBTOOL) --mode=link $(CC) -avoid-version -module -rpath --${APACHE2_LIBEXEC} $(LT_LDFLAGS) $(ALL_LDFLAGS)to
MOD_LINK = $(LIBTOOL) --mode=link $(CC) -avoid-version -module -rpath ${APACHE2_LIBEXEC} $(LT_LDFLAGS) $(ALL_LDFLAGS) -Wl,-brtl
Now, on with the build:
$ gmake$ cd ../../jk/build/jk2/apache2$ cp -p libmod_jk2.so /home/trawick/gcc_httpd_mod_jk2/install/modules/Add the appropriate LoadModule to Apache 2's configuration file and away you go.
Apache httpd 2.0.46, gcc, mod_jk from jakarta-tomcat-connectors-jk-1.2.3-src.tar.gz
Build Apache as covered in the previous section.building mod_jk
$ cd /home/trawick$ gtar -xzf jakarta-tomcat-connectors-jk-1.2.3-src.tar.gz$ cd jakarta-tomcat-connectors-jk-1.2.3-src/jk/native$ ./buildconf.sh$ CC=gcc ./configure --with-apxs=/home/trawick/gcc_httpd_mod_jk2/install/bin/apxsBefore running make, edit apache-2.0/Makefile and change the line (around line 65)
$(LIBTOOL) --mode=link ${COMPILE} -o $@ -module -rpath ${libexecdir} -avoid-version mod_jk.lo $(APACHE_OBJECTS)to read
$(LIBTOOL) --mode=link ${COMPILE} -o $@ -module -rpath ${libexecdir} -avoid-version mod_jk.lo $(APACHE_OBJECTS) -Wl,-brtlbeing sure not to mess up the
A more appropriate fix was submitted to the Tomcat developers on 20030618, so hopefully this problem won't exist forever in the mod_jk distribution. The fix described above is fine for AIX and is easier to insert manually.
Now, on with the build:
$ gmakeYou may just hit this obscure error during make if you originally configured libtool using IBM's C compiler for AIX:
Waiting for jk_something.o.lock to be removed.The work-around is to edit libtool (whichever one is found in PATH) and change the setting of the variable need_locks to "warn", then run gmake again. Here is the section in the libtool script:
# Must we lock files when doing compilation ?need_locks="yes"need_locks="warn"After
gmake
completes successfully, install mod_jk.so into the Apache modules directory with this command: gmake installIf you want to manually copy the DSO, do it like this, since the filename is not correct:
$ cp -p apache-2.0/libmod_jk.so /home/trawick/gcc_httpd_mod_jk2/install/modules/mod_jk.so(This issue with the filename exists on at least AIX, Tru64, and HP-UX.)
To load it into Apache, add the following directive to httpd.conf:
LoadModule jk_module modules/mod_jk.so
'개발자愛 > JAVA' 카테고리의 다른 글
crontab : 윈도우의 스케줄러와 같은 역할을 하는 명령어 (0) | 2008.03.04 |
---|---|
JAVA base64 incoding decoding (0) | 2007.12.21 |
"Ajax in practice" 이벤트~ ^^* (0) | 2007.11.06 |
IBM AIX 에서 tomcat-connector (mod_jk.so) 만들기 (0) | 2007.11.06 |
DIV - 테이블은 이제 쉬어야할때... (0) | 2007.09.22 |