在 Spring 4.3.9下升级 Velocity 1.7.x to Velocity 2.0.x 出现的问题
Spring to 出现 升级 2.0 1.7 4.3 velocity
2023-09-27 14:21:33 时间
1: Spring 的 spring-context-support
报错 java.lang.NoClassDefFoundError: org/apache/velocity/runtime/log/CommonsLogLogChute
等待 Spring 升级支持 Velocity 2.0.x 或自己改 Spring 的源码
velocity整个初始化日志过程:
- new RuntimeInstance(),属性Log log = new Log(), 默认创建一个HoldingLogChute()做为LogChute,(该LogChute临时记录日志到内存对象上)
- RuntimeInstance.init() 进行velocity系统初始化
- 顺序调用initializeProperties(), 读取velocity.properties默认配置,合并自定义的properties。
- 顺序调用initializeLog() ,调用LogManager.updateLog(),进行Log初始化
- LogManager.createLogChute()会首先读取runtime.log.logsystem配置,看看是否有存在自定义的LogChute实例对象,如果有则直接使用,并返回
- 在没有对应的LogChute实例对象配置,继续读取runtime.log.logsystem.class,看看似乎否有logsystem的配置,就是前面类图中的一对LogChute,LogSystem的实现类。
-
runtime.log.logsystem.class = org.apache.velocity.runtime.log.AvalonLogChute,org.apache.velocity.runtime.log.Log4JLogChute,org.apache.velocity.runtime.log.CommonsLogLogChute,org.apache.velocity.runtime.log.ServletLogChute,org.apache.velocity.runtime.log.JdkLogChute
-
- LogManager,针对createLogChute,将系统初始时HoldingLogChute记录的内容,输出到新的LogChute上,最后完成了log的初始化
可以参考:http://agapple.iteye.com/blog/815872
2:更改 Velocity.properties
runtime.conversion.handler = none space.gobbling = bc
以上是目前发现的问题
相关文章
- Spring 项目启动测试的时候错误:Unable to acquire JDBC Connection
- Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.1.RELEASE from https...
- 转载 WebService 的CXF框架 WS方式Spring开发
- The web application [ROOT] appears to have started a thread named [spring.cloud.inetutils] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
- Spring Boot 启动:No active profile set, falling back to default profiles: default
- Spring @Async的异常处理
- Spring Boot + Redis 实现Shiro集群
- class path resource [spring/] cannot be resolved to URL because it does not exist
- 记录:Spring Boot 报错:Web server failed to start. Port 8081 was already in use.
- spring boot jar包替换报错之Unable to open nested entry 'BOOT-INF/lib/cache-api-0.4.jar'.
- spring mvc绑定复杂对象报错“Could not instantiate property type [com.ld.net.spider.pojo.WorkNode] to auto-grow nested property path: java.lang.InstantiationException: com.ld.net.spider.pojo.WorkNode”