springboot项目启动失败
项目启动报错
org.springframework.context.applicationcontextexception: unable to start web server; nested exception is org.springframework.boot.web.server.webserverexception: unable to start embedded tomcat
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext.onrefresh(servletwebserverapplicationcontext.java:156)
at org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:544)
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext.refresh(servletwebserverapplicationcontext.java:141)
at org.springframework.boot.springapplication.refresh(springapplication.java:747)
at org.springframework.boot.springapplication.refreshcontext(springapplication.java:397)
at org.springframework.boot.springapplication.run(springapplication.java:315)
at org.springframework.boot.springapplication.run(springapplication.java:1226)
at org.springframework.boot.springapplication.run(springapplication.java:1215)
at com.cxy.develop.developapplication.main(developapplication.java:14)
caused by: org.springframework.boot.web.server.webserverexception: unable to start embedded tomcat
at org.springframework.boot.web.embedded.tomcat.tomcatwebserver.initialize(tomcatwebserver.java:126)
at org.springframework.boot.web.embedded.tomcat.tomcatwebserver.<init>(tomcatwebserver.java:88)
at org.springframework.boot.web.embedded.tomcat.tomcatservletwebserverfactory.gettomcatwebserver(tomcatservletwebserverfactory.java:438)
at org.springframework.boot.web.embedded.tomcat.tomcatservletwebserverfactory.getwebserver(tomcatservletwebserverfactory.java:191)
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext.createwebserver(servletwebserverapplicationcontext.java:180)
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext.onrefresh(servletwebserverapplicationcontext.java:153)
... 8 common frames omitted
caused by: org.springframework.beans.factory.beancreationexception: error creating bean with name 'formcontentfilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/webmvcautoconfiguration.class]: bean instantiation via factory method failed; nested exception is org.springframework.beans.beaninstantiationexception: failed to instantiate [org.springframework.boot.web.servlet.filter.orderedformcontentfilter]: factory method 'formcontentfilter' threw exception; nested exception is java.lang.noclassdeffounderror: could not initialize class com.fasterxml.jackson.databind.objectmapper
at org.springframework.beans.factory.support.constructorresolver.instantiate(constructorresolver.java:656)
at org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:484)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiateusingfactorymethod(abstractautowirecapablebeanfactory.java:1338)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:1177)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:557)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:517)
at org.springframework.beans.factory.support.abstractbeanfactory.lambda$dogetbean$0(abstractbeanfactory.java:323)
at org.springframework.beans.factory.support.abstractbeanfactory$$lambda$157/246273275.getobject(unknown source)
at org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222)
at org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:321)
at org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:207)
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.getorderedbeansoftype(servletcontextinitializerbeans.java:211)
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.addasregistrationbean(servletcontextinitializerbeans.java:174)
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.addasregistrationbean(servletcontextinitializerbeans.java:169)
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.addadaptablebeans(servletcontextinitializerbeans.java:154)
at org.springframework.boot.web.servlet.servletcontextinitializerbeans.<init>(servletcontextinitializerbeans.java:86)
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext.getservletcontextinitializerbeans(servletwebserverapplicationcontext.java:253)
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext.selfinitialize(servletwebserverapplicationcontext.java:227)
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext$$lambda$392/118881143.onstartup(unknown source)
at org.springframework.boot.web.embedded.tomcat.tomcatstarter.onstartup(tomcatstarter.java:53)
at org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5140)
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1384)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1374)
at java.util.concurrent.futuretask.run(futuretask.java:266)
at org.apache.tomcat.util.threads.inlineexecutorservice.execute(inlineexecutorservice.java:75)
at java.util.concurrent.abstractexecutorservice.submit(abstractexecutorservice.java:134)
at org.apache.catalina.core.containerbase.startinternal(containerbase.java:909)
at org.apache.catalina.core.standardhost.startinternal(standardhost.java:841)
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1384)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1374)
at java.util.concurrent.futuretask.run(futuretask.java:266)
at org.apache.tomcat.util.threads.inlineexecutorservice.execute(inlineexecutorservice.java:75)
at java.util.concurrent.abstractexecutorservice.submit(abstractexecutorservice.java:134)
at org.apache.catalina.core.containerbase.startinternal(containerbase.java:909)
at org.apache.catalina.core.standardengine.startinternal(standardengine.java:262)
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
at org.apache.catalina.core.standardservice.startinternal(standardservice.java:421)
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
at org.apache.catalina.core.standardserver.startinternal(standardserver.java:930)
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
at org.apache.catalina.startup.tomcat.start(tomcat.java:468)
at org.springframework.boot.web.embedded.tomcat.tomcatwebserver.initialize(tomcatwebserver.java:107)
... 13 common frames omitted
caused by: org.springframework.beans.beaninstantiationexception: failed to instantiate [org.springframework.boot.web.servlet.filter.orderedformcontentfilter]: factory method 'formcontentfilter' 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:185)
at org.springframework.beans.factory.support.constructorresolver.instantiate(constructorresolver.java:651)
... 56 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:650)
at org.springframework.http.converter.json.mappingjackson2httpmessageconverter.<init>(mappingjackson2httpmessageconverter.java:59)
at org.springframework.http.converter.support.allencompassingformhttpmessageconverter.<init>(allencompassingformhttpmessageconverter.java:76)
at org.springframework.web.filter.formcontentfilter.<init>(formcontentfilter.java:61)
at org.springframework.boot.web.servlet.filter.orderedformcontentfilter.<init>(orderedformcontentfilter.java:29)
at org.springframework.boot.autoconfigure.web.servlet.webmvcautoconfiguration.formcontentfilter(webmvcautoconfiguration.java:161)
at sun.reflect.nativemethodaccessorimpl.invoke0(native method)
at sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)
at sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)
at java.lang.reflect.method.invoke(method.java:497)
at org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:154)
... 57 common frames omitted
process finished with exit code 1
打开项目或者对应模块的maven依赖图
根据报错知道是
com.fasterxml.jackson.databind.objectmapper出了问题
ctrl + f输入jackson发现有几个annotations, 点击进去
选择冲突节点
移除依赖(shift + delete)
再查找,可以发现剩下一个
并且pom文件中某个依赖添加了exclusion
最后启动成功!!!
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论