无法从其他模块使用Appender(ClassNotFoundException)

时间:2019-07-29 13:45:37

标签: maven spring-boot logback appender

由于某些原因,我无法使用其他模块中的自定义附加器

我的结构:

  • 项目
    • 后端
      • src
        • 主要
          • 资源
            • logback.xml
    • 记录
      • logging-mongo
        • src
          • 主要
            • java
              • MongoLogAppender.java

我在后端的pom.xml中具有logging-mongo依赖性,并且我的IntelliJ通过logback.xml文件可以看到MongoLogAppender.java类,但是当我尝试构建时,会看到以下日志消息:

2019-07-29_15:34:14 - [main] ERROR o.s.boot.SpringApplication.reportFailure.858 - Application run failed

java.lang.IllegalStateException: Logback configuration error detected: 

ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [systems.promera.sun.logging.mongo.MongoLogAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type systems.promera.sun.logging.mongo.MongoLogAppender  

ERROR in ch.qos.logback.core.joran.spi.Interpreter@12:90 - ActionException in Action for tag [appender] ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type systems.promera.sun.logging.mongo.MongoLogAppender 

    at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)

    at org.springframework.boot.logging.logback.LogbackLoggingSystem.reinitialize(LogbackLoggingSystem.java:224)

    at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:75)

    at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)

    at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)

    at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:293)

    at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:266)

    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:229)

    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:202)

    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)

    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)

    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)

    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)

    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)

    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)

    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)

    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)

    at systems.promera.sun.backend.BackEndApplication.main(BackEndApplication.java:21)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)

    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)

    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)

    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)

Exception in thread "main" java.lang.reflect.InvocationTargetException

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)

    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)

    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)

    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)

Caused by: java.lang.IllegalStateException: Logback configuration error detected: 

ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [systems.promera.sun.logging.mongo.MongoLogAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type systems.promera.sun.logging.mongo.MongoLogAppender

0 个答案:

没有答案