On 12/05/2020 11:40, Adam Retter wrote: > Hi there, > > I have a Java project which is using JNI to load a native library. I > would like to install it as a Windows service. > > To install it I am running: > > prunsrv.exe install FusionDB-Server --DisplayName=FusionDB-Server > --Description="FusionDB Server" --StdError=auto --StdOutput=auto > --LogPath="C:\Users\aretter\AppData\Roaming\FusionDB Server\logs" > --LogPrefix=service --PidFile=service.pid --Startup=auto > --ServiceUser=LocalSystem --Jvm="C:\Program > Files\BellSoft\LibericaJRE-11-Full\bin\client\jvm.dll" > --Classpath="C:/Program Files/FusionDB Server/lib/*" --JvmMs=128m > --StartMode=jvm --StartClass=org.exist.service.ExistDbDaemon > --StartMethod=start --StopMode=jvm > --StopClass=org.exist.service.ExistDbDaemon --StopMethod=stop > --JvmOptions="-Dfile.encoding=UTF-8;-Dlog4j.configurationFile=C:\Program > Files\FusionDB Server/etc/log4j2.xml;-Djetty.home=C:\Program > Files\FusionDB Server;-Dexist.jetty.config=C:\Program Files\FusionDB > Server/etc/jetty/standard.enabled-jetty-configs;-Djetty.git.hash=ab228fde9e55e9164c738d7fa121f8ac5acd51c9;-Dexist.home=C:\Program > Files\FusionDB Server;-Dexist.configurationFile=C:\Program > Files\FusionDB Server/etc/conf.xml" --StartParams="C:\Program > Files\FusionDB Server\etc\conf.xml" --JvmMx=4224m" > > > However, when I then try and start the Service for my application, my > application raises an error when it tries to load the native library > via Java's System.load(absolutePathToLib) and fails to start up: > > Caused by: java.lang.UnsatisfiedLinkError: > C:\Windows\Temp\librocksdbjni18005926251924699790.dll: Can't find > dependent libraries > at java.lang.ClassLoader$NativeLibrary.load0(Native Method) ~[?:?] > at java.lang.ClassLoader$NativeLibrary.load(Unknown Source) ~[?:?] > at java.lang.ClassLoader$NativeLibrary.loadLibrary(Unknown Source) ~[?:?] > at java.lang.ClassLoader.loadLibrary0(Unknown Source) ~[?:?] > at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[?:?] > at java.lang.Runtime.load0(Unknown Source) ~[?:?] > at java.lang.System.load(Unknown Source) ~[?:?] > at > org.rocksdb.NativeLibraryLoader.loadLibraryFromJar(NativeLibraryLoader.java:79) > ~[rocksdbjni-202004011324-patched-debug.jar:?] > > If I run my application directly, i.e. not via the Service, then it is > able to correctly load the native library and start's up ok. > > I have tested this on both Windows Server 2012 and 2019 with both JRE > 8 and JRE 11. > > Are there limitations on loading native libraries (or their > dependencies) from a Java Application started from a Procrun service? > I am also using StartMode "jvm" perhaps that has some limitation in this area?
It shouldn't. Maybe a permissions problem? Although running as LocalService is should be fine. I guess check the obvious. Does the dll exist where the app is looking? Can LocalSystem read that file etc. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org