A primitive web app sketch involving Java extensions to a native library
(JNI) used up front in a ServletContextListener works when started via
bin\startup.bat but doesn't work when installed as a Windows service and
started via bin\tomcat6w.exe in the case of 6.0.18 or bin\tomcat5w.exe
in the case of 5.5.27, on Windows XP.

Here's the libraries I need:

:: dir /s /b *.dll
C:\src\BerkeleyDbXml\dbxml-2.4.16\bin\debug\libdb46d.dll
C:\src\BerkeleyDbXml\dbxml-2.4.16\bin\debug\libdbxml24d.dll
C:\src\BerkeleyDbXml\dbxml-2.4.16\bin\debug\libdbxml_java24d.dll
C:\src\BerkeleyDbXml\dbxml-2.4.16\bin\debug\libdb_java46d.dll
C:\src\BerkeleyDbXml\dbxml-2.4.16\bin\debug\xerces-c_2_8D.dll
C:\src\BerkeleyDbXml\dbxml-2.4.16\bin\debug\xqilla21d.dll

The directory containing these libraries *is* included in PATH.

Likewise, it is included as follows on the Java tab of tomcat5w.exe:

-Djava.library.path=C:\src\BerkeleyDbXml\dbxml-2.4.16\bin\debug

The error thrown when starting Tomcat 5 or 6 as the service with the app
in question is the following:

java.lang.UnsatisfiedLinkError: no libdb_java46 in java.library.path

I'm checking I *really* have the bin\debug directory in the path by
doing the following:

  System.out.println( System.getProperty( "java.library.path"));
  ...
  env = new Environment( envHome, envConf); // triggers the error

And I do get the relevant directory in the output.

Now there is one subtlety, that you may or may not have noticed: The
library I have in my directory is libdb_java46d.dll (note the "d" for
"debug version" after the version number), the library name in the error
message, however, is "libdb_java46" (the "d" is missing). This had me
confused and sent on the wrong tracks at first.

But I'm assured by the developers that:

  The Java API for DB XML begins by first trying to load the
  release versions of the libraries, and failing that then tries
  to load the debug versions. If it fails to find both versions
  then the UnsatisfiedLinkError is thrown listing the release
  library, even though it did look for the debug library.

Java-API in Tomcat 6: libdb_java46.dll UnsatisfiedLinkError (2.4.16+p1)
http://forums.oracle.com/forums/thread.jspa?threadID=848389

And indeed, this works using bin\startup.cmd.

I tried to run the service using various JVMs, but that didn't dispel
the error.

What could make the script version succeed and the service version
fail with both Tomcat 5.5 and 6?

What could I do to find the error?

Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to