Springboot项目因为kackson版本问题启动报错解决方案
问题现象
org.springframework.context.applicationcontextexception: unable to start embedded container; nested exception is org.springframework.boot.context.embedded.embeddedservletcontainerexception: unable to start embedded tomcat
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext.onrefresh(embeddedwebapplicationcontext.java:137) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:536) ~[spring-context-4.3.8.release.jar:4.3.8.release]
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.springapplication.refresh(springapplication.java:737) [spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.springapplication.refreshcontext(springapplication.java:370) [spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.springapplication.run(springapplication.java:314) [spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.springapplication.run(springapplication.java:1162) [spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.springapplication.run(springapplication.java:1151) [spring-boot-1.5.3.release.jar:1.5.3.release]
at startdemo.startdemoapplication.main(startdemoapplication.java:15) [classes/:na]
caused by: org.springframework.boot.context.embedded.embeddedservletcontainerexception: unable to start embedded tomcat
at org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainer.initialize(tomcatembeddedservletcontainer.java:123) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainer.<init>(tomcatembeddedservletcontainer.java:84) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainerfactory.gettomcatembeddedservletcontainer(tomcatembeddedservletcontainerfactory.java:554) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainerfactory.getembeddedservletcontainer(tomcatembeddedservletcontainerfactory.java:179) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext.createembeddedservletcontainer(embeddedwebapplicationcontext.java:164) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext.onrefresh(embeddedwebapplicationcontext.java:134) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
... 8 common frames omitted
caused by: org.springframework.beans.factory.beancreationexception: error creating bean with name 'httpputformcontentfilter' defined in class path resource [org/springframework/boot/autoconfigure/web/webmvcautoconfiguration.class]: bean instantiation via factory method failed; nested exception is org.springframework.beans.beaninstantiationexception: failed to instantiate [org.springframework.boot.web.filter.orderedhttpputformcontentfilter]: factory method 'httpputformcontentfilter' threw exception; nested exception is java.lang.noclassdeffounderror: could not initialize class com.fasterxml.jackson.databind.objectmapper
at org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:599) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiateusingfactorymethod(abstractautowirecapablebeanfactory.java:1173) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:1067) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:513) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:483) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:202) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.getorderedbeansoftype(servletcontextinitializerbeans.java:234) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.addasregistrationbean(servletcontextinitializerbeans.java:182) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.addasregistrationbean(servletcontextinitializerbeans.java:177) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.addadaptablebeans(servletcontextinitializerbeans.java:159) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.<init>(servletcontextinitializerbeans.java:80) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext.getservletcontextinitializerbeans(embeddedwebapplicationcontext.java:241) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext.selfinitialize(embeddedwebapplicationcontext.java:228) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext.access$000(embeddedwebapplicationcontext.java:89) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.embeddedwebapplicationcontext$1.onstartup(embeddedwebapplicationcontext.java:213) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.context.embedded.tomcat.tomcatstarter.onstartup(tomcatstarter.java:55) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5196) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1419) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1409) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
at java.util.concurrent.futuretask.run(unknown source) ~[na:1.8.0_121]
at java.util.concurrent.threadpoolexecutor.runworker(unknown source) ~[na:1.8.0_121]
at java.util.concurrent.threadpoolexecutor$worker.run(unknown source) ~[na:1.8.0_121]
at java.lang.thread.run(unknown source) ~[na:1.8.0_121]
caused by: org.springframework.beans.beaninstantiationexception: failed to instantiate [org.springframework.boot.web.filter.orderedhttpputformcontentfilter]: factory method 'httpputformcontentfilter' threw exception; nested exception is java.lang.noclassdeffounderror: could not initialize class com.fasterxml.jackson.databind.objectmapper
at org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:189) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
at org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:588) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
... 26 common frames omitted
caused by: java.lang.noclassdeffounderror: could not initialize class com.fasterxml.jackson.databind.objectmapper
at org.springframework.http.converter.json.jackson2objectmapperbuilder.build(jackson2objectmapperbuilder.java:588) ~[spring-web-4.3.8.release.jar:4.3.8.release]
at org.springframework.http.converter.json.mappingjackson2httpmessageconverter.<init>(mappingjackson2httpmessageconverter.java:57) ~[spring-web-4.3.8.release.jar:4.3.8.release]
at org.springframework.http.converter.support.allencompassingformhttpmessageconverter.<init>(allencompassingformhttpmessageconverter.java:61) ~[spring-web-4.3.8.release.jar:4.3.8.release]
at org.springframework.web.filter.httpputformcontentfilter.<init>(httpputformcontentfilter.java:63) ~[spring-web-4.3.8.release.jar:4.3.8.release]
at org.springframework.boot.web.filter.orderedhttpputformcontentfilter.<init>(orderedhttpputformcontentfilter.java:29) ~[spring-boot-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.autoconfigure.web.webmvcautoconfiguration.httpputformcontentfilter(webmvcautoconfiguration.java:166) ~[spring-boot-autoconfigure-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.autoconfigure.web.webmvcautoconfiguration$$enhancerbyspringcglib$$29ab2425.cglib$httpputformcontentfilter$1(<generated>) ~[spring-boot-autoconfigure-1.5.3.release.jar:1.5.3.release]
at org.springframework.boot.autoconfigure.web.webmvcautoconfiguration$$enhancerbyspringcglib$$29ab2425$$fastclassbyspringcglib$$1c9d1ecb.invoke(<generated>) ~[spring-boot-autoconfigure-1.5.3.release.jar:1.5.3.release]
at org.springframework.cglib.proxy.methodproxy.invokesuper(methodproxy.java:228) ~[spring-core-4.3.8.release.jar:4.3.8.release]
at org.springframework.context.annotation.configurationclassenhancer$beanmethodinterceptor.intercept(configurationclassenhancer.java:358) ~[spring-context-4.3.8.release.jar:4.3.8.release]
at org.springframework.boot.autoconfigure.web.webmvcautoconfiguration$$enhancerbyspringcglib$$29ab2425.httpputformcontentfilter(<generated>) ~[spring-boot-autoconfigure-1.5.3.release.jar:1.5.3.release]
at sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.8.0_121]
at sun.reflect.nativemethodaccessorimpl.invoke(unknown source) ~[na:1.8.0_121]
at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) ~[na:1.8.0_121]
at java.lang.reflect.method.invoke(unknown source) ~[na:1.8.0_121]
at org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:162) ~[spring-beans-4.3.8.release.jar:4.3.8.release]
... 27 common frames omitted
解决方法
更改pom文件的配置
<dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-databind</artifactid> <exclusions> <exclusion> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-annotations</artifactid> </exclusion> </exclusions> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-annotations</artifactid> <version>2.9.0</version> </dependency>
总结
到此这篇关于springboot项目因为kackson版本问题启动报错解决方案的文章就介绍到这了,更多相关springboot项目启动报错内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
上一篇: 如何在python中实现线性回归
下一篇: 2020-07-22