Apache Tomcat doesn't find Native library

shylynx picture shylynx · May 4, 2013 · Viewed 8.7k times · Source

I maintained countless instances of tomcat but now I run into a problem I never ran into before.

I get the well known log message where tomcat complains that it can't find the native lib at D:\Programme\Apache Software Foundation\Tomcat 7.0\bin:

"The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Programme\Apache Software Foundation\Tomcat 7.0\bin; [...]"

As usual I put the native lib "tcnative-1.dll" into the bin-folder of Tomcat (and yes, it is at drive D:!!), but tomcat furthermore complains the missing native lib.

I also tried to specify -Djava.library.path at startup, but without success. There are no further messages in the log that may indicate other problems at startup.

Why doesn't tomcat find the native lib?

The web is full of stupid trial-and-error-approaches and the tomcat documentation doesn't explicitly describes under which circumstances it doesn't take the native lib in the bin-folder.

Additional info:

Apache Tomcat 7.0.8

JVM 1.6.0_29-b11

Answer

Olaf Kock picture Olaf Kock · May 4, 2013

Check if the DLL bitsize matches your JDK bitsize (not the OS bitsize): E.g. if you run Win64, but a 32bit Java, make sure to have a 32bit DLL.