当我像“startcatalina”一样从cmd启动tomcat时,另一个cmd终端打开,然后出现下面给出的错误。如何修复?
... SEVERE [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[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1069)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1719)
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: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader;
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:210)
at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1855)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1119)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5095)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
1条答案
按热度按时间prdp8dxp1#
当java代码试图调用类中不存在的方法时,会出现java.lang.nosucmethoderror,该方法可以是静态方法,也可以是非静态方法。
也许你的问题的解决办法就在这里
java.lang.nosuchmethoderror:javax.servlet.servletcontext.getcontextpath()ljava/lang/string
javax.servlet.servletcontext.getcontextpath()ljava/lang/string