# Tomcat 5.5 with native apr support?

## tld

I recently installed tomcat 5.5.20 on my development machine, including all the unmasking and the list of dependencies as long as my arm  :Very Happy: .  I was curious about the native apr support.  I get the messages in the log file explaining that it can't find the native tomcat libraries.

I also see that the 'jni' use flag that apparently used to be used in the tomcat ebuild isn't there.

Has anyone manually compiled and installed the native tomcat libraries after installing tomcat from portage?

Thanks.

Tom

----------

## tomk

I've manually installed tomcat 5.5.x to use APR at work, although we don't use Gentoo there (yet!). I was using it for the OpenSSL support instead of using JSSE using the instructions here. To get it to work I had to add the locations of the APR and JNI lib directories to LD_LIBRARY_PATH in the startup script and add SSLEngine="on" and the SSLCertificateFile and SSLCertificateKeyFile attributes to the SSL Connector part of server.xml.

Hope that helps.

----------

## tld

Thanks for the reply.  I'll remember to do that.  I'm guessing that compiling it may require telling it a bunch of paths, seeing how gentoo puts tomcat in different directories than the standard tomcat install.

Tom

----------

## wltjr

It's currently hard masked due to apr-1.x being hard masked. But you can unmask both and emerge tomcat-native. If you have a default Tomcat server.xml there is nothing more to do. When you start Tomcat it will look for, find and load libtcnative-1.so. If you have modified your server.xml then you will need to add back the listener, or turn it on for the native library. There is no need to set LD_LIBRARY_PATH or etc. The code does not use it, and libtcnative-1.so is installed in the standard path, and registered with ld.

----------

## tld

Thanks for the reply.  I think I'm missing something here.  I've installed tomcat-native, and I do have the default server.xml.  However I'm still seeing this in the catalina log file:

```
Jan 10, 2007 5:57:31 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent

INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/sun-jdk-1.5.0.09/jre/lib/i386/client:/opt/sun-jdk-1.5.0.09/jre/lib/i386:/opt/sun-jdk-1.5.0.09/jre/../lib/i386
```

I'm also a bit confused as to why it appears to be specifically looking for the native library in the java library path.  Exactly what needs to be enabled in the server.xml?  The only thing I see that appears to be related is this:

```
<Listener className="org.apache.catalina.core.AprLifecycleListener" />
```

...and that is in fact enabled.  Thanks in advance.

Tom

----------

## wltjr

Interesting your path is not looking in /usr/lib. Mine was by default. Not sure what's up there. In your case I would edit /etc/conf.d/tomcat-5.5 and add LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib or CATALINA_OPTS="-Djava.library.path=/usr/lib". Either of those should get things working for you.

----------

## tld

Yup...that did it.  Thanks!

Tom

----------

## whowar

I'm using Sun JDK 1.5.0.11 [sun-jdk-1.5] on Gentoo and I'm also getting the same problem.  This bug helps to explain why java.library.path only needs updating for some (i.e. those who are not using blackdown's java).

https://bugs.gentoo.org/show_bug.cgi?id=125563

----------

