This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Log4j - NTEventLogAppender (Library is already loaded in another ClassLoader) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j - NTEventLogAppender (Library is already loaded in another ClassLoader) " Watch "Log4j - NTEventLogAppender (Library is already loaded in another ClassLoader) " New topic
Author

Log4j - NTEventLogAppender (Library is already loaded in another ClassLoader)

Hill Xie
Greenhorn

Joined: Feb 20, 2009
Posts: 2
I have two applications deployed to the same profile on websphere server, they both need to log information to windows event log using log4j. First, I set up the log4j as a shared library, then reference the shared library from both applications and copy the NTEventLogAppender.dll to the windows\system32. It works well when I use "org.apache.log4j.DailyRollingFileAppender" as appender in the configuration file, I can see the new entry logged in the log file. but after I changed to "org.apache.log4j.nt.NTEventLogAppender", I got the error:

java.lang.UnsatisfiedLinkError: NTEventLogAppender (Library is already loaded in another ClassLoader).

By research on interent, I understand this is because the NTEventLogAppender.dll, as a native dll file, is not controlled by websphere server. To avoid this error, it is my responsibility to ensure the dll is only loaded once. There is also an example on the internet to show how to create an utility JAR file and load the native dll file, then set up it as shared library. But with log4j I have no idea how to do this. I have spent lots of time trying to figure out, but still no luck . Could anyone please advise? Any help will be highly appreciated!
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there and welcome to Javaranch,

I'm afraid I don't have any further knowledge to share, but have you tried the Log4J mailing lists?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Hill Xie
Greenhorn

Joined: Feb 20, 2009
Posts: 2
Thank you! I just found the mail list and post a message. (Cross my fingers)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Log4j - NTEventLogAppender (Library is already loaded in another ClassLoader)
 
Similar Threads
Log4J, NTEventLogAppender
Log4J NTEventLogAppender configuration through properties file
SQL JDBC Tomcat "Native Library sqljdbc_auth.dll already loaded in another classloader"
Rescheduling a Timer Task
conflicting jar files and .dll