导致原因:升级到Java 11后,IntelliJ中的com.fasterxml.jackson.databind.ObjectMapper。java.lang.ClassNotFoundExcept
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导致原因:升级到Java 11后,IntelliJ中的com.fasterxml.jackson.databind.ObjectMapper。java.lang.ClassNotFoundExcept相关的知识,希望对你有一定的参考价值。
java -jar app.jar
运行它就可以了。 虽然尝试在IntelliJ中运行,但出现以下错误:Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
这里是完整的堆栈跟踪:
2020-04-28 13:07:36.079 ERROR 83492 --- [lication Thread] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesReportEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@6adede5]
2020-04-28 13:07:36.092 INFO 83492 --- [lication Thread] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-04-28 13:07:36.099 ERROR 83492 --- [lication Thread] org.apache.catalina.core.ContainerBase : A child container failed during stop
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesReportEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@6adede5]
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:211)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:202)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:96)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:85)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:253)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:227)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5140)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.embed.core@9.0.33/org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.embed.core@9.0.33/org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.tomcat.embed.core@9.0.33/org.apache.catalina.startup.Tomcat.start(Tomcat.java:468)
at spring.boot@2.2.6.RELEASE/org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:107)
... 19 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesReportEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@6adede5]
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
... 59 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesReportEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@6adede5]
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at spring.context@5.2.5.RELEASE/org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108)
at spring.boot.actuator@2.2.6.RELEASE/org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.createEndpointBean(EndpointDiscoverer.java:143)
at spring.boot.actuator@2.2.6.RELEASE/org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.createEndpointBeans(EndpointDiscoverer.java:133)
at spring.boot.actuator@2.2.6.RELEASE/org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.discoverEndpoints(EndpointDiscoverer.java:122)
at spring.boot.actuator@2.2.6.RELEASE/org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.getEndpoints(EndpointDiscoverer.java:116)
at spring.boot.actuator.autoconfigure@2.2.6.RELEASE/org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.servletEndpointRegistrar(ServletEndpointManagementContextConfiguration.java:65)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 60 more
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@6adede5]
at spring.core@5.2.5.RELEASE/org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
at spring.core@5.2.5.RELEASE/org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149)
at spring.context@5.2.5.RELEASE/org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:310)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1094)
at spring.beans@5.2.5.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:569)
... 76 more
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3167)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2310)
at spring.core@5.2.5.RELEASE/org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
... 83 more
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 87 more
Exception in Application stop method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application stop method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:905)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
at gui/de.company.project.MyMainClass.stop(MyMainClass.java:87)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$10(LauncherImpl.java:865)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Exception running application de.company.project.MyMainClass
这是我的附属物:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.10.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
我已经尝试删除Jackson依赖项,但没有任何变化。
升级到Java 11和Spring Boot 2.2.6 / Jackson 2.10.3之后,我无法在Intellij中启动我的应用程序。用maven编译后,使用java -jar app.jar运行它就可以了。当...
java -jar app.jar
这将打包您当前的代码,并需要将适当的文件添加到CLASSPATH。 2)现在,当您通过maven生成jar时,它将下载第3方必需的类,然后将您的应用程序打包到jar中,而jar中将包含前面提到的下载的类。因此,在运行该jar时,将显示所有必需的类。
我希望我清除了您对上述问题发生的原因的怀疑。如果没有,请联系我,我会尽力帮助您。
祝你好运,学习愉快!
以上是关于导致原因:升级到Java 11后,IntelliJ中的com.fasterxml.jackson.databind.ObjectMapper。java.lang.ClassNotFoundExcept的主要内容,如果未能解决你的问题,请参考以下文章
获取noclassfoundexception:jdk 11的intellij idea中的java.sql.SQLException
从 kivy 1.11.1 升级到 kivy 2.0.0 后,应用程序在启动时抛出错误。任何想法?
肝了两天IntelliJ IDEA 2020,解锁11种新姿势, 真香!!!