开发者

NTEventLogAppender (Library is already loaded in another ClassLoader)

I have a log4j.properties file like this on my src package:

log4j.rootLogger=DEBUG, CA, EVA 

#Console Appender 
log4j.appender.CA=org.apache.log4j.ConsoleAppender 
log4j.appender.CA.layout=org.apache.log4j.PatternLayout 
log4j.appende开发者_Python百科r.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 

#Event Viewer Appender
log4j.appender.EVA=org.apache.log4j.nt.NTEventLogAppender
log4j.appender.EVA.layout=org.apache.log4j.PatternLayout
log4j.appender.EVA.source=MySource
log4j.appender.EVA.layout.ConversionPattern=[%c][%l][%p][%thread]: %m%n

I create the logger on a interface (LogInterface.java) like this:

package components;

import org.apache.log4j.Logger;

public interface LogInterface {

    static final Logger logger = Logger.getLogger("MyLogger");

}

I place the NTEventLogAppender.dll under:

C:\Program Files (x86)\IBM\WID7_WTE\runtimes\bi_v7\java\jre\bin

Sometimes I am getting the following error when there is an exception to log:

NTEventLogAppender (Library is already loaded in another ClassLoader)

How can I solve this issue?

Thanks


The solution for this problem was to place the log4j JAR file under:

Application_Server_Install_Path\lib

On the project I added the log4j JAR file to the project's build path as a variable (add variable option)

This solves the JAR reference on the IDE the only thing left to do is to add the previous log4j JAR file reference on the Websphere Application Server's runtime.

To do this I accessed the WAS administration console and added the previous log4j JAR file path under:

Environment -> Shared Libraries

Despite no one seems to have this same problem, here's the solution for future similar problems

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜