我在Spring Boot 2.0.3应用程序中使用spring 4.x依赖项jar,jar中的类之一取决于org.springframework.util.Log4jConfigurer
以下是启动应用程序时得到的异常跟踪
ERROR: org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'log4jConfigurer' defined in class path resource [common-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/util/Log4jConfigurer
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1708)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
Caused by: java.lang.NoClassDefFoundError: org/springframework/util/Log4jConfigurer
at com.xyz.common.util.config.XyzLog4jConfigurer.initializeLog4JConfigurer(XyzLog4jConfigurer.java:58)
at com.xyz.common.util.config.XyzLog4jConfigurer.init(XyzLog4jConfigurer.java:24)
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.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1833)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1776)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1704)
... 24 more
我具有以下与依赖项目的ivy.xml中的类相对应的ivy配置
<dependency org="org.springframework" name="spring-core" rev="4.1.6" conf="compile->compile(*),master(*);runtime->runtime(*);all->default(*)"/>
我不明白为什么会发生错误。有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
这是因为有2.0.3版的Spring Boot。我认为Log4jConfigurer在2.0版中已弃用。通过使用弹簧靴1.5.10.RELEASE
进行了修复。