java.lang.NoClassDefFoundError:无法初始化类org.apache.log4j.net.ZeroConfSupport

时间:2018-04-12 15:23:34

标签: java log4j mybatis weblogic12c mybatis-cdi

我试图在weblogic-server 12.1.1.0上部署一个简单的EJB项目(the project)。该程序使用mybatis 3.4.4和mybatis-cdi 1.0.0。 但是我在部署中遇到了异常。

Caused by: java.lang.NullPointerException:
        at org.apache.log4j.net.ZeroConfSupport.initializeJMDNS(ZeroConfSupport.java:190)
        at org.apache.log4j.net.ZeroConfSupport.<clinit>(ZeroConfSupport.java:29)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)

我想在添加这些依赖项后,mybatis lib的log4j设置不正常:

commons-logging-1.2.jar
jmdns-3.4.1.jar
log4j-1.2.17.jar
log4j-core-2.3.jar

到目标的lib文件夹,我得到以下异常:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.net.ZeroConfSupport
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at weblogic.ejb.container.deployer.ModuleExtensionContextImpl.internalGetBeanClasses(ModuleExtensionContextImpl.java:178)
        at weblogic.ejb.container.deployer.ModuleExtensionContextImpl.getBeanClasses(ModuleExtensionContextImpl.java:131)

mybatis-config就像:

<configuration>
    <settings>
        <setting name="logImpl" value="SLF4J"/>
        ...
    </settings>
</configuration>

我该怎么做才能解决问题?

0 个答案:

没有答案