2

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

VC1
  • 1,660
  • 4
  • 25
  • 42
shylynx
  • 597
  • 1
  • 7
  • 25

3 Answers3

1

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.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • Checked. Is all 32-Bit: Windows is 32-bit, Java is 32-bit, dll is 32-bit as well. But no success. – shylynx May 04 '13 at 18:39
0

Create setenv.bat into D:\Programme\Apache Software Foundation\Tomcat 7.0\bin and put a following line in it.

set JAVA_OPTS=-Djava.library.path="D:\Programme\Apache Software Foundation\Tomcat 7.0\bin"

Is this work for you?

Shinichi Kai
  • 4,415
  • 2
  • 21
  • 25
  • Tomcat is started as a service, so I set the system environment variable via system properties, but also without success. Tomcat complains again the missing libraries. – shylynx May 15 '13 at 17:53
  • Please try adding "D:\Programme\Apache Software Foundation\Tomcat 7.0\bin" to the **PATH** system environment variable and reboot your computer. Does it make any difference? – Shinichi Kai May 16 '13 at 00:05
0

It is an old post, but I lose a lot of time with the same problem. so I would like to post my solution about this problem.

1st step: copy paste your dll in a java.path for example in windows C:\Windows\System32

2nd step: set VM Option: -Djava.library.path="C:\Windows\System32"

in netebeans rightClick on project --> properties --> run -->fill textfield in vmOption.

Jimmysnn
  • 583
  • 4
  • 8
  • 30
  • What do you mean by java.path in the 1st step? Have you set this variable or have you get this value from the variable java.path and put it to java.library.path? – shylynx Jul 18 '14 at 07:14
  • I use default java path. Also you can change java.path. for more information look in this tutorial http://docs.oracle.com/javase/tutorial/essential/environment/paths.html – Jimmysnn Jul 18 '14 at 11:18
  • I guess tomcat recognize new path. I have not test it with new java.path variable. I used the default path, "C:\Windows\System32". – Jimmysnn Jul 18 '14 at 11:22
  • Your answer is the same as "Shinichi Kai". I always added the path of the library to -Djava.library.path. – shylynx Jul 21 '14 at 08:14