gpt4 book ai didi

解决IDEA配置tomcat启动报错问题

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 25 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章解决IDEA配置tomcat启动报错问题由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

在配置servlet不同路径时遇上以下两个错误:

java.lang.nosuchmethoderror: javax.servlet.servletcontext.getvirtualservername()ljava/lang/string;  java.lang.classnotfoundexception: org.apache.jsp.index_jsp; 。

对于第一个问题,我上网查阅了很多资料后发现,可能是tomcat版本冲突导致,catalina log如下:

19-feb-2018 08:26:44.175 信息 [main] org.apache.catalina.startup.versionloggerlistener.log server version:        apache tomcat/8.5.28 19-feb-2018 08:26:44.175 信息 [main] org.apache.catalina.startup.versionloggerlistener.log server built:          feb 6 2018 23:10:25 utc 19-feb-2018 08:26:44.175 信息 [main] org.apache.catalina.startup.versionloggerlistener.log server number:         8.5.28.0 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log os name:               windows 7 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log os version:            6.1 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log architecture:          x86 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log java home:             c:\program files\java\jdk1.8.0_141\jre 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log jvm version:           1.8.0_141-b15 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log jvm vendor:            oracle corporation 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log catalina_base:         f:\apache-tomcat-8.5.28 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log catalina_home:         f:\apache-tomcat-8.5.28 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -djava.util.logging.config.file=f:\apache-tomcat-8.5.28\conf\logging.properties 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -djava.util.logging.manager=org.apache.juli.classloaderlogmanager 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -djdk.tls.ephemeraldhkeysize=2048 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -djava.protocol.handler.pkgs=org.apache.catalina.webresources 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -dignore.endorsed.dirs= 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -dcatalina.base=f:\apache-tomcat-8.5.28 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -dcatalina.home=f:\apache-tomcat-8.5.28 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.startup.versionloggerlistener.log command line argument: -djava.io.tmpdir=f:\apache-tomcat-8.5.28\temp 19-feb-2018 08:26:44.191 信息 [main] org.apache.catalina.core.aprlifecyclelistener.lifecycleevent loaded apr based apache tomcat native library [1.2.16] using apr version [1.6.3]. 19-feb-2018 08:26:44.206 信息 [main] org.apache.catalina.core.aprlifecyclelistener.lifecycleevent apr capabilities: ipv6 [true], sendfile [true], accept filters [false], random [true]. 19-feb-2018 08:26:44.206 信息 [main] org.apache.catalina.core.aprlifecyclelistener.lifecycleevent apr/openssl configuration: useaprconnector [false], useopenssl [true] 19-feb-2018 08:26:44.830 信息 [main] org.apache.catalina.core.aprlifecyclelistener.initializessl openssl successfully initialized [openssl 1.0.2m  2 nov 2017] 19-feb-2018 08:26:45.080 信息 [main] org.apache.coyote.abstractprotocol.init initializing protocolhandler ["http-nio-8080"] 19-feb-2018 08:26:45.517 信息 [main] org.apache.tomcat.util.net.nioselectorpool.getsharedselector using a shared selector for servlet write/read 19-feb-2018 08:26:45.581 信息 [main] org.apache.coyote.abstractprotocol.init initializing protocolhandler ["ajp-nio-8009"] 19-feb-2018 08:26:45.597 信息 [main] org.apache.tomcat.util.net.nioselectorpool.getsharedselector using a shared selector for servlet write/read 19-feb-2018 08:26:45.597 信息 [main] org.apache.catalina.startup.catalina.load initialization processed in 2422 ms 19-feb-2018 08:26:45.643 信息 [main] org.apache.catalina.core.standardservice.startinternal starting service [catalina] 19-feb-2018 08:26:45.643 信息 [main] org.apache.catalina.core.standardengine.startinternal starting servlet engine: apache tomcat/8.5.28 19-feb-2018 08:26:45.675 信息 [localhost-startstop-1] org.apache.catalina.startup.hostconfig.deploydirectory deploying web application directory [f:\apache-tomcat-8.5.28\webapps\docs] 19-feb-2018 08:26:46.423 信息 [localhost-startstop-1] org.apache.catalina.startup.hostconfig.deploydirectory deployment of web application directory [f:\apache-tomcat-8.5.28\webapps\docs] has finished in [748] ms 19-feb-2018 08:26:46.423 信息 [localhost-startstop-1] org.apache.catalina.startup.hostconfig.deploydirectory deploying web application directory [f:\apache-tomcat-8.5.28\webapps\examples] 19-feb-2018 08:26:47.059 严重 [localhost-startstop-1] org.apache.catalina.core.containerbase.addchildinternal containerbase.addchild: start:   org.apache.catalina.lifecycleexception: failed to start component [standardengine[catalina].standardhost[localhost].standardcontext[/examples]] at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:167) at org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:752) at org.apache.catalina.core.containerbase.addchild(containerbase.java:728) at org.apache.catalina.core.standardhost.addchild(standardhost.java:734) at org.apache.catalina.startup.hostconfig.deploydirectory(hostconfig.java:1141) at org.apache.catalina.startup.hostconfig$deploydirectory.run(hostconfig.java:1875) at java.util.concurrent.executors$runnableadapter.call(executors.java:511) at java.util.concurrent.futuretask.run(futuretask.java:266) at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1149) at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:624) at java.lang.thread.run(thread.java:748) caused by: org.apache.catalina.lifecycleexception: failed to start component [pipeline[standardengine[catalina].standardhost[localhost].standardcontext[/examples]]] at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:167) at org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5125) at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) ... 10 more caused by: org.apache.catalina.lifecycleexception: failed to start component [org.apache.catalina.authenticator.formauthenticator[/examples]] at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:167) at org.apache.catalina.core.standardpipeline.startinternal(standardpipeline.java:182) at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) ... 12 more caused by: java.lang.nosuchmethoderror: javax.servlet.servletcontext.getvirtualservername()ljava/lang/string; at org.apache.catalina.authenticator.authenticatorbase.startinternal(authenticatorbase.java:1186) at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) ... 14 more 19-feb-2018 08:26:47.075 严重 [localhost-startstop-1] org.apache.catalina.startup.hostconfig.deploydirectory error deploying web application directory [f:\apache-tomcat-8.5.28\webapps\examples]  java.lang.illegalstateexception: containerbase.addchild: start: org.apache.catalina.lifecycleexception: failed to start component [standardengine[catalina].standardhost[localhost].standardcontext[/examples]] at org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:756) at org.apache.catalina.core.containerbase.addchild(containerbase.java:728) at org.apache.catalina.core.standardhost.addchild(standardhost.java:734) at org.apache.catalina.startup.hostconfig.deploydirectory(hostconfig.java:1141) at org.apache.catalina.startup.hostconfig$deploydirectory.run(hostconfig.java:1875) at java.util.concurrent.executors$runnableadapter.call(executors.java:511) at java.util.concurrent.futuretask.run(futuretask.java:266) at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1149) at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:624) at java.lang.thread.run(thread.java:748) 。

我先试着删除其他tomcat版本,重新配置tomcat环境变量并重新部署tomcat。发现并没有解决问题,再次上网查阅,发现getcontextpath()在servlet2.5特有。于是试着删除原先jar包中的servlet-api.jar,然后重新部署项目。发现了第二个问题,log如下:

19-feb-2018 09:59:51.534 严重 [http-nio-8080-exec-3] org.apache.catalina.core.standardwrappervalve.invoke servlet.service() for servlet [jsp] in context with path [/happy] threw exception [java.lang.classnotfoundexception: org.apache.jsp.index_jsp] with root cause  java.lang.classnotfoundexception: org.apache.jsp.index_jsp at java.net.urlclassloader.findclass(urlclassloader.java:381) at org.apache.jasper.servlet.jasperloader.loadclass(jasperloader.java:129) at org.apache.jasper.servlet.jasperloader.loadclass(jasperloader.java:60) at org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:159) at org.apache.jasper.servlet.jspservletwrapper.getservlet(jspservletwrapper.java:171) at org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:380) at org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:386) at org.apache.jasper.servlet.jspservlet.service(jspservlet.java:330) at javax.servlet.http.httpservlet.service(httpservlet.java:847) at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:231) at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166) at org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:193) at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166) at org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:199) at org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:96) at org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:140) at org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:81) at org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:650) at org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:87) at org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:342) at org.apache.coyote.http11.http11processor.service(http11processor.java:803) at org.apache.coyote.abstractprocessorlight.process(abstractprocessorlight.java:66) at org.apache.coyote.abstractprotocol$connectionhandler.process(abstractprotocol.java:790) at org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1459) at org.apache.tomcat.util.net.socketprocessorbase.run(socketprocessorbase.java:49) at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1149) at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:624) at org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) at java.lang.thread.run(thread.java:748) 19-feb-2018 10:03:45.289 严重 [http-nio-8080-exec-1] org.apache.catalina.core.standardwrappervalve.invoke servlet.service() for servlet [jsp] in context with path [/happy] threw exception [unable to compile class for jsp] with root cause  java.lang.classnotfoundexception: com.sun.el.expressionfactoryimpl at org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1291) at org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1119) at javax.el.factoryfinder.newinstance(factoryfinder.java:83) at javax.el.factoryfinder.find(factoryfinder.java:193) at javax.el.expressionfactory.newinstance(expressionfactory.java:185) at javax.el.expressionfactory.newinstance(expressionfactory.java:156) at org.apache.jasper.compiler.pageinfo.<init>(pageinfo.java:80) at org.apache.jasper.compiler.compiler.generatejava(compiler.java:117) at org.apache.jasper.compiler.compiler.compile(compiler.java:374) at org.apache.jasper.compiler.compiler.compile(compiler.java:351) at org.apache.jasper.compiler.compiler.compile(compiler.java:335) at org.apache.jasper.jspcompilationcontext.compile(jspcompilationcontext.java:595) at org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:368) at org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:386) at org.apache.jasper.servlet.jspservlet.service(jspservlet.java:330) at javax.servlet.http.httpservlet.service(httpservlet.java:847) at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:231) at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166) at org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:193) at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166) at org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:199) at org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:96) at org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:140) at org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:81) at org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:650) at org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:87) at org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:342) at org.apache.coyote.http11.http11processor.service(http11processor.java:803) at org.apache.coyote.abstractprocessorlight.process(abstractprocessorlight.java:66) at org.apache.coyote.abstractprotocol$connectionhandler.process(abstractprotocol.java:790) at org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1459) at org.apache.tomcat.util.net.socketprocessorbase.run(socketprocessorbase.java:49) at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1149) at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:624) at org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) at java.lang.thread.run(thread.java:748) 。

再次查阅资料,发现是缺少jar包。因为jdk1.8的扩展jar包里没有servlet相关api,故idea会导入失败.

解决IDEA配置tomcat启动报错问题

此时需要导入jar包,之前我是下载相关api 。

解决IDEA配置tomcat启动报错问题

然后放到下图目录中 。

解决IDEA配置tomcat启动报错问题

为了防止出现缺少jar包问题,建议直接去tomcat目录下的lib中找到servlet-api.jar,直接复制到ext中。然后再重新部署一下tomcat,问题解决.

总结 。

到此这篇关于解决idea配置tomcat启动报错问题的文章就介绍到这了,更多相关idea配置tomcat启动报错内容请搜索我以前的文章或继续浏览下面的相关文章希望大家以后多多支持我! 。

原文链接:https://blog.csdn.net/weixin_36570768/article/details/79336672 。

最后此篇关于解决IDEA配置tomcat启动报错问题的文章就讲到这里了,如果你想了解更多关于解决IDEA配置tomcat启动报错问题的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com