Velocity 2.0: NoClassDefFoundError: org/apache/velocity/runtime/log/CommonsLogLogChute [英] Velocity 2.0: NoClassDefFoundError: org/apache/velocity/runtime/log/CommonsLogLogChute
问题描述
在使用 Velocity 2.0 启动我的 Web 应用程序时,我收到以下错误:
On starting up my Web app with Velocity 2.0 I'm getting the following error:
Caused by: java.lang.NoClassDefFoundError:
org/apache/velocity/runtime/log/CommonsLogLogChute
at org.springframework.ui.velocity.VelocityEngineFactory.createVelocityEngine(VelocityEngineFactory.java:240)
at org.springframework.ui.velocity.VelocityEngineFactoryBean.afterPropertiesSet(VelocityEngineFactoryBean.java:60)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 34 more
已满足所有依赖项.我们正在使用
All dependencies have been satisfied. We are using
- slf4j-api-1.7.25.jar
- slf4j-simple-1.7.25.jar
- commons-lang3-3.5.jar
- commons-io-2.5.jar
- commons-logging-1.2.jar(是的,我们有 Commons-Logging)
在 applicationContext.xml 中,velocityEngine bean 定义如下
In applicationContext.xml the velocityEngine bean is defined as follows
<bean id="velocityEngine"
class="org.springframework.ui.velocity.VelocityEngineFactoryBean"/>
对此有什么想法吗?
我的文件 velocity-engine-core-2.0.jar
只包含以下 .runtime
子包:
My file velocity-engine-core-2.0.jar
only contains the following .runtime
subpackages:
defaults, directive, parser, resource, visitor
但没有 log
.
UPDATE Spring Velocity Engine bean 声明中的以下 overrideLogging = FALSE 解决了该问题.为什么?
UPDATE The following overrideLogging = FALSE in the Spring Velocity Engine bean declaration solved the problem. But why?
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="overrideLogging" value="false" />
</bean>
我只是按照提示https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/ui/velocity/VelocityEngineFactory.html但不确定发生了什么.
I just followed a tip on https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/ui/velocity/VelocityEngineFactory.html but not sure what happened.
推荐答案
当 overrideLogging 为 true 时,Spring 仍然需要类 org.apache.velocity.runtime.log.CommonsLogLogChute,但它在 Velocity 2.0 中消失了,因为 Velocity现在使用 slf4j 日志框架.
When overrideLogging is true, the class org.apache.velocity.runtime.log.CommonsLogLogChute is still required by Spring while it has disappeared in Velocity 2.0, since Velocity now uses the slf4j logging framework.
如果需要使 overrideLogging 为真,则需要等待 Spring Velocity 类的更新.
You'll need to wait for an update of the Spring Velocity classes if you need overrideLogging to be true.
这篇关于Velocity 2.0: NoClassDefFoundError: org/apache/velocity/runtime/log/CommonsLogLogChute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!