所有
我之前使用Spring Cloud / Spring Boot的早期版本构建了Spring Cloud Config服务器和客户端,但我似乎遇到了Angel.SR4 / Boot 1.3.1组合的问题。
遵循此处的基本说明(http://projects.spring.io/spring-cloud/docs/1.0.3/spring-cloud.html#_client_side_usage),除了使用当前版本的Boot和Cloud(目前为1.3.1.RELEASE / Angel.SR4)之外,我得到以下堆栈跟踪:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.logging.ClasspathLoggingApplicationListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:412)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:392)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:383)
at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:263)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113)
at demo.Application.main(Application.java:10)
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:142)
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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:405)
... 7 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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 21 more
如果我将Boot版本退回到1.2.8,问题就会消失。如果我将云移动到Brixton.M4,问题就会消失。是否应该一起使用Boot / Cloud的规定版本组合?提前谢谢。
ķ
答案 0 :(得分:2)
是否应该同时使用Boot / Cloud的规定版本组合?
是。 Angel是Boot 1.2,Brixton是Boot 1.3。有关详细信息,请参阅博客:https://spring.io/blog/2015/11/25/migrating-spring-cloud-apps-from-spring-boot-1-2-to-1-3