1

我尝试将 Spring Boot 版本从 1.2.2 版本更改为 1.3.0M5。在运行 spring boot run 时出现以下异常。我尝试在构建和运行时更新快照,但无济于事。

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(Abstr
actRunMojo.java:435)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Cannot instantiate interface      org.
springframework.context.ApplicationListener :org.springframework.boot.logging.ClasspathLoggingApplicationListener
at org.springframework.boot.SpringApplication.getSpringFactoriesInstance
s(SpringApplication.java:385)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstance
s(SpringApplication.java:362)
at org.springframework.boot.SpringApplication.initialize(SpringApplicati
on.java:231) 
at org.springframework.boot.SpringApplication.(SpringApplication.j
ava:206)
... 6 more
Caused by: java.lang.NoClassDefFoundError:   org/springframework/context/event/GenericApplicationListener
 at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstance
s(SpringApplication.java:378) 
.  .. 10 more
Caused by: java.lang.ClassNotFoundException:      org.springframework.context.event.GenericApplicationListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 23 more
4

1 回答 1

3

您正在强制使用不同于 Spring Boot 1.3 所需的 Spring Framework 版本。

通常,您应该让 spring boot 为您派生版本,并且仅在遇到特定问题时才覆盖。查看有关依赖项管理的文档以获取更多详细信息。

1.3.0.M5需要spring框架4.2.1

于 2015-09-16T22:20:23.370 回答