在 logback 中使用条件处理时未找到 FileExistsPropertyDefiner class
FileExistsPropertyDefiner class not found when using conditional processing in logback
我们有一个 spring-boot 项目并配置 logback-spring.xml 如下
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
<include resource="org/springframework/boot/logging/logback/base.xml" />
<define name="INCLUDED_FILE_EXISTS"
class=" ch.qos.logback.core.property.FileExistsPropertyDefiner">
<path>application.properties</path>
</define>
<if condition='property("INCLUDED_FILE_EXISTS").equals("true")'>
<then>
<property resource="application.properties" />
</then>
</if>
<property resource = "config/application.properties" />
...
</configuration>
由于在不同的模式下会有不同的属性(例如,dev 或 production),我们想像上面的配置一样有条件地处理 属性 资源。如果 application.properties 文件存在,那么它将被加载,而 config/application.properties 将始终被加载。
但是,我们在启动时遇到以下错误:
14:21:09,923 |-ERROR in ch.qos.logback.core.joran.action.DefinePropertyAction - Could not create an PropertyDefiner of type [ ch.qos.logback.core.property.FileExistsPropertyDefiner]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:73)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:48)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:35)
at at ch.qos.logback.core.joran.actcion.DefinePropertyAction.begin(DefinePropertyAction.java:73)
at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:275)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:147)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:129)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:165)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:137)
at at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:71)
at at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:106)
at at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:262)
at at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:233)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:176)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119)
at at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
at at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
at at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:325)
at at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
at at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149)
at at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129)
at at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85)
at at com.ute.dc.tenant.ServletInitializer.onStartup(ServletInitializer.java:29)
at at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5156)
at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.property.FileExistsPropertyDefiner
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:60)
at ... 41 common frames omitted
14:21:09,925 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:67 - ActionException in Action for tag [define] ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at at ch.qos.logback.core.joran.action.DefinePropertyAction.begin(DefinePropertyAction.java:84)
at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:275)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:147)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:129)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:165)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:137)
at at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:71)
at at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:106)
at at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:262)
at at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:233)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:176)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119)
at at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
at at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
at at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:325)
at at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
at at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149)
at at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129)
at at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85)
at at com.ute.dc.tenant.ServletInitializer.onStartup(ServletInitializer.java:29)
at at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5156)
at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at at java.lang.Thread.run(Thread.java:745)
Caused by: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:73)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:48)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:35)
at at ch.qos.logback.core.joran.action.DefinePropertyAction.begin(DefinePropertyAction.java:73)
at ... 38 common frames omitted
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.property.FileExistsPropertyDefiner
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:60)
at ... 41 common frames omitted
我们使用的 logback 是来自 spring-boot-starter-logging 1.3.1-RELEASE 的 1.1.3,我们使用的用于条件处理的 janino 库是 2.7.8。我们没有声明 janino 的版本,但它进入了 v2.7.8,我不知道为什么。
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</dependency>
有什么我们想念的吗?感谢任何帮助。
双引号 "
和包名称之间的 space 字符放错地方了:
class=" ch.qos.logback.core.property.FileExistsPropertyDefiner"
应该是:
class="ch.qos.logback.core.property.FileExistsPropertyDefiner"
我们有一个 spring-boot 项目并配置 logback-spring.xml 如下
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
<include resource="org/springframework/boot/logging/logback/base.xml" />
<define name="INCLUDED_FILE_EXISTS"
class=" ch.qos.logback.core.property.FileExistsPropertyDefiner">
<path>application.properties</path>
</define>
<if condition='property("INCLUDED_FILE_EXISTS").equals("true")'>
<then>
<property resource="application.properties" />
</then>
</if>
<property resource = "config/application.properties" />
...
</configuration>
由于在不同的模式下会有不同的属性(例如,dev 或 production),我们想像上面的配置一样有条件地处理 属性 资源。如果 application.properties 文件存在,那么它将被加载,而 config/application.properties 将始终被加载。
但是,我们在启动时遇到以下错误:
14:21:09,923 |-ERROR in ch.qos.logback.core.joran.action.DefinePropertyAction - Could not create an PropertyDefiner of type [ ch.qos.logback.core.property.FileExistsPropertyDefiner]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:73)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:48)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:35)
at at ch.qos.logback.core.joran.actcion.DefinePropertyAction.begin(DefinePropertyAction.java:73)
at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:275)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:147)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:129)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:165)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:137)
at at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:71)
at at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:106)
at at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:262)
at at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:233)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:176)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119)
at at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
at at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
at at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:325)
at at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
at at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149)
at at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129)
at at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85)
at at com.ute.dc.tenant.ServletInitializer.onStartup(ServletInitializer.java:29)
at at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5156)
at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.property.FileExistsPropertyDefiner
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:60)
at ... 41 common frames omitted
14:21:09,925 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:67 - ActionException in Action for tag [define] ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at at ch.qos.logback.core.joran.action.DefinePropertyAction.begin(DefinePropertyAction.java:84)
at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:275)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:147)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:129)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:165)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:137)
at at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:71)
at at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:49)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:106)
at at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:262)
at at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:233)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
at at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:176)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
at at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119)
at at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
at at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
at at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:325)
at at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
at at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149)
at at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129)
at at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85)
at at com.ute.dc.tenant.ServletInitializer.onStartup(ServletInitializer.java:29)
at at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5156)
at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at at java.lang.Thread.run(Thread.java:745)
Caused by: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.property.FileExistsPropertyDefiner
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:73)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:48)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:35)
at at ch.qos.logback.core.joran.action.DefinePropertyAction.begin(DefinePropertyAction.java:73)
at ... 38 common frames omitted
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.property.FileExistsPropertyDefiner
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:60)
at ... 41 common frames omitted
我们使用的 logback 是来自 spring-boot-starter-logging 1.3.1-RELEASE 的 1.1.3,我们使用的用于条件处理的 janino 库是 2.7.8。我们没有声明 janino 的版本,但它进入了 v2.7.8,我不知道为什么。
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</dependency>
有什么我们想念的吗?感谢任何帮助。
双引号 "
和包名称之间的 space 字符放错地方了:
class=" ch.qos.logback.core.property.FileExistsPropertyDefiner"
应该是:
class="ch.qos.logback.core.property.FileExistsPropertyDefiner"