Wrapper and Log4j NTEventLogAppender

Paul Wade
2014-02-08
2014-02-08
  • Paul Wade
    Paul Wade
    2014-02-08

    I'm trying to configure the NTEventLogAppender using the WrapperSimpleApp. I've added the location of the DLL to both the Java classpath and the system path. I've set wrapper.java.library.path.append_system_path=TRUE and in my logging application I'm outputting the java.class.path and the java.library.path system properties to the console. Both contain the exact path to my DLL. However, I'm still getting this error:

    INFO | jvm 5 | 2014/02/07 17:48:41 | WrapperSimpleApp Error: Class my.app.App found but could not be initialized: java.lang.UnsatisfiedLinkError: no NTEventLogAppender in java.library.path

    I've placed the DLL in the same path as the wrapper.dll file, I've tried putting it in /bin, /lib, the application root, System32, etc. Nothing works. If I run my app outside of the wrapper it works correctly. I've already ready this similar question here http://java-service-wrapper.996253.n3.nabble.com/Help-with-Event-Logging-td2715.html but none of that advice seems to work.

    Any thoughts on how I can troubleshoot this? I'm at my wits end at this point because everything I can see says that the DLL should be found.

    Thanks.

     
  • Leif Mortenson
    Leif Mortenson
    2014-02-08

    Paul,
    The JVM is going to locate all of its native libraries on the java.library.path, not the classpath or system PATH.
    http://wrapper.tanukisoftware.com/doc/english/prop-java-library-path-n.html

    If you are using any relative paths in your library path please realize that they will be relative to the location of the wrapper.exe binary. This is sometimes different than when you run standalone. It is much more reliable when running from different locations.

    As noted on the above page, please note that some JNI libraries also require their own DLLs. Those secondary DLLs must be located on the system PATH as they are located by the system and not the JVM.

    Another possible source of trouble is that a 32-bit JVM will ONLY load a 32-bit DLL. Likewise a 64-bit JVM will ONLY load a 64-bit DLL. Please make sure that the bits of the DLL match that of the JVM. This will usually give you a slightly different exception however.

    The message you are getting is saying that it is not being found though, so my guess is that your library path is not correct given its location.

    Cheers,
    Leif