Eclipse:升级到Spring Boot 2.0.1后无法检测类异常

时间:2018-04-19 18:54:57

标签: java eclipse hibernate maven spring-boot

将Vaadin Spring Boot项目从1.5.9升级到2.0.1后,我在使用Could not instrument class...在Eclipse中启动应用程序时遇到多个spring-boot:run异常。使用spring-boot:run从命令行执行应用程序不会显示异常。

如果没有成功,我已经尝试在Eclipse中清理项目,更新maven项目并删除.m2文件夹。

如果从命令行或从Eclipse开始,应用程序本身似乎没有明显的问题。

如果我从Eclipse启动Spring Boot,则会显示一个例外:

[INFO] --- spring-boot-maven-plugin:2.0.1.RELEASE:run (default-cli) @ project ---
Could not instrument class org/hibernate/validator/internal/engine/valueextraction/ObservableValueValueExtractor: java.lang.RuntimeException
at com.ifedorenko.org.objectweb.asm.ClassVisitor.visitTypeAnnotation(Unknown Source)
at com.ifedorenko.org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.ifedorenko.org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.ifedorenko.m2e.sourcelookup.javaagent.ClassfileTransformer.transform(ClassfileTransformer.java:27)
at com.ifedorenko.m2e.sourcelookup.javaagent.Premain$1.transform(Premain.java:55)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.hibernate.validator.internal.engine.valueextraction.ValueExtractorManager.<clinit>(ValueExtractorManager.java:43)
at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:140)
at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38)
at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:364)
at org.springframework.boot.autoconfigure.BackgroundPreinitializer$ValidationInitializer.run(BackgroundPreinitializer.java:142)
at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.runSafely(BackgroundPreinitializer.java:92)
at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.run(BackgroundPreinitializer.java:82)
at java.lang.Thread.run(Thread.java:745)

我的设置:

  • Java 8 JDK 171
  • Eclipse Oxygen.3a
  • Spring Boot 2.0.1
  • Maven 3.3.9

知道如何摆脱或导致异常的原因吗?

1 个答案:

答案 0 :(得分:1)

问题似乎是由Eclipse中的Maven Development Tools plugin引起的。卸载插件后,错误消息将消失。

但是,我在使用此插件时可以在调试spring boot maven应用程序时查看源代码(请参阅Eclipse not picking up Maven attached source on debug)。没有插件,我在调试时会收到“Source not found”,即使对于我自己的类也是如此。