1

**hi friends i am new to use Tomcat6 i had everything done last week and Tomcat was worked. But now i can't use Tomcat6 other machine. I searched lot but i could not find true answer for my problem

please help me **

SEVERE: Error deploying configuration descriptor host-manager.xml
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
at org.apache.catalina.core.StandardHost$MemoryLeakTrackingListener.lifecycleEvent(StandardHost.java:616)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4700)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Petar Minchev
  • 46,889
  • 11
  • 103
  • 119
Uğur Tangl
  • 11
  • 1
  • 1
  • 3

2 Answers2

2

It look like that you've an older version of the Servlet API somewhere in the classpath which overrides the Tomcat 6.0 Servlet API (Servlet API 2.5).

Sai Ye Yan Naing Aye
  • 6,622
  • 12
  • 47
  • 65
  • my project group use Servlet API 2.4. nobody has that issue. i said that it will be servlet 2.5 but they work on (successfully) servlet 2.4. that means that problem don't contains 2.4 always. – Uğur Tangl Aug 10 '12 at 07:54
  • @Uğur Tangl - the method the [`ServletContext.getContextPath()`](http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#getContextPath%28%29) is a new method in Servlet 2.5. It does look like an old jar is on the Tomcat 6 classpath. – McDowell Aug 10 '12 at 09:26
  • i still use 2.4 servlet and now someone help me and fix that problem. That means , this problem does not include from servlet 2.4 :( i wished i answer how it was but i didnt understand what someone did. – Uğur Tangl Aug 13 '12 at 06:33
  • @UğurTangl you can download servlet api 2.5 jar and add TOMCAT_HOME\lib folder.Don't forget to delete old servlet api 2.4 jar in your lib folder. or Change your tomcat to tomcat 7 – Sai Ye Yan Naing Aye Aug 13 '12 at 07:43
  • @SaiYeYanNaingAye i answerd that option on your top. – Uğur Tangl Aug 14 '12 at 11:29
  • i am working with ofbiz and that included the servlet-api 2.4 jar after removing that jar everything seems fine – Mateen Jan 16 '15 at 05:41
0

This is the weird ERROR. Causes of problem:- the servlet api which is in ur Java-Built path overrides the servlet-api of ur Tomcat Server. Solution :-first goto ur project Built path and remove ur Sevlet-api of version whuch is not supported by ur Tomcat Server 6. Then goto>Java Built Path > Libraries if u have the Apache Tomcat v6.0 [Apache Tomcat v6.0 ] library it is done. else goto > add Library > Server Runtime > and select Apache Tomcat v6.0 and click Ok.

Hasnain Ali Bohra
  • 2,130
  • 2
  • 11
  • 25