启动报错:class: interface org.apache.dubbo.common.logger.LoggerAdapter) couldn't be instantiated: null

背景

Dubbo项目启动时报错,如下所示:

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
    at org.opensaml.xml.XMLConfigurator.<clinit>(XMLConfigurator.java:60)
    at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:195)
    at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91)
    at com.intuit.ipp.aggcat.util.SAML2AssertionGenerator.getSAMLBuilder(SAML2AssertionGenerator.java:156)
    at com.intuit.ipp.aggcat.util.SAML2AssertionGenerator.createSubject(SAML2AssertionGenerator.java:187)
    at com.intuit.ipp.aggcat.util.SAML2AssertionGenerator.buildAssertion(SAML2AssertionGenerator.java:114)
    at com.intuit.ipp.aggcat.util.SAML2AssertionGenerator.generateSignedAssertion(SAML2AssertionGenerator.java:83)
    at com.intuit.ipp.aggcat.util.SamlUtil.createSignedSAMLPayload(SamlUtil.java:156)
    at com.intuit.ipp.aggcat.util.OAuthUtil.getOAuthTokens(OAuthUtil.java:60)
    at com.intuit.ipp.aggcat.core.OAuthAuthorizer.<init>(OAuthAuthorizer.java:85)
    at com.incomemax.view.intuit.WebUtil.getAggCatService(WebUtil.java:91)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
    ... 64 more

解决

经过Google之后,在StackOverFlow上找到解决办法,在SpringBoot项目中引入log4j2依赖,同时在dubbo的配置文件中指定loggerlog4j2即可

image

image

Reference

logging - Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger - Stack Overflow

posted @ 2024-09-29 16:47  Reecelin  阅读(5)  评论(0编辑  收藏  举报