How to start Apache Tomcat with SAP JCo on Linux
One of the most web application server in open source community is Apache Tomcat. The latest stable version is 5.5.20. It is possible to develop a web application that tightly interfaces to SAP R/3 or its components via SAP JCo aka SAP Java Connector. Its latest version is 2.1.7. It is a little bit tricky to run SAP JCo inside Apache Tomcat on Linux.
In this howto, I assume that:
- Linux distribution Ubuntu Edgy Eft 6.10
- Apache Tomcat 5.5.20 installed at
/opt/tomcat
- SAP JCo 2.1.7 installed at
/opt/sapjco
Make sure that the native shared libraries in /opt/sapjco
are loadable by running ldd
to verify dependencies.
$ ldd /opt/sapjco/librfccm.so
linux-gate.so.1 => (0xffffe000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7a04000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb79fb000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb79e7000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb78b3000)
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0xb786b000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7845000)
/lib/ld-linux.so.2 (0x80000000)
If you get like above, you are lucky. In some cases, you might get something like below.
libstdc++-libc6.2-2.so.3 => not found
It is clearly you don't have libstdc++-libc6.2-2.so.3
. You may install libstdc++2.10-glibc2.2
to resolve this dependency.
sudo apt-get install libstdc++2.10-glibc2.2
Next is to try the same at libsapjcorfc.so
.
$ ldd /opt/sapjco/libsapjcorfc.so
linux-gate.so.1 => (0xffffe000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7b97000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7b8e000)
librfccm.so => not found
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7a59000)
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0xb7a11000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb79eb000)
/lib/ld-linux.so.2 (0x80000000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb79d8000)
You may get not found for librfccm.so
. Try to set LD_LIBRARY_PATH
to see it help or not.
$ LD_LIBRARY_PATH=/opt/sapjco ldd /opt/sapjco/libsapjcorfc.so
linux-gate.so.1 => (0xffffe000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7c39000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7c30000)
librfccm.so => /opt/sapjco/librfccm.so (0xb76ea000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb75b6000)
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0xb756e000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7548000)
/lib/ld-linux.so.2 (0x80000000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7535000)
Hooray! It works. This is a good signal. So you just to have a wrapper script to start and stop Tomcat correctly.
#!/bin/sh
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/jre
TOMCAT_HOME=/opt/tomcat
SAPJCO_HOME=/opt/sapjco
LD_LIBRARY_PATH=$SAPJCO_HOME
export JAVA_HOME TOMCAT_HOME LD_LIBRARY_PATH
case "$1" in
start)
$TOMCAT_HOME/bin/startup.sh
;;
stop)
$TOMCAT_HOME/bin/shutdown.sh
;;
esac
The idea is very easy. You need to add /opt/sapjco
to LD_LIBRARY_PATH
. If you copied them to /usr/lib
, you don't need this wrapper. Using above script is as follows (assuming that the script named tomcat
.
To start:
tomcat start
To shutdown:
tomcat stop
- sugree's blog
- 5100 reads
Post new comment