I take it you also included j2ee.jar in that search?

--David

Armand Rock wrote:

Hi,
I'm getting the same error.  I searched my entire computer for any jar/zip
files containing javax.servlet.ServletContext
and renamed all of them to ".original" so that they wouldn't be read by the
JVM.  I did this to all the files except for the file
common/lib/servlet-api.jar

I'm still getting the problem.

I'm using java version 1.4.2_10

The code i'm using used to work under Orion version 1.4.5 (I'm now using
Tomcat 5.5)
The code that eventually throws the exception is basically:

ClassFinder classFinder = new ClassFinder();
classFinder.addFile("/opt/classes/com/canlink/commands/");
Class usrClass = classFinder.findClass("com.canlink.commands.TestClass");

This line is what throws the exception:
        Method setCmdLog = usrClass.getMethod("setCmdLog", new Class[]
{Boolean.class});

The stack trace is:
SEVERE: Servlet.service() for servlet RunCmd threw exception
java.lang.NoClassDefFoundError: javax/servlet/ServletContext
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at com.canlink.commands.RunCmd.service(RunCmd.java:240)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)
        at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDis
patcher.java:463)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:398)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:301)
        at org.apache.jsp.web.Login_jsp._jspService(Login_jsp.java:67)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
22)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:663)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
        at java.lang.Thread.run(Unknown Source)

-----Original Message-----
From: Tim Funk [mailto:[EMAIL PROTECTED]
Sent: December 6, 2005 6:30 AM
To: Tomcat Users List
Subject: Re: Question concerning java.lang.NoClassDefFoundError:
javax/servlet/ServletContext


See - http://tomcat.apache.org/faq/classnotfound.html

Odds are you have your own servlet-api.jar somewhere in the webapp or system
classpath and that is conflicting with the one in common/lib (installed by
tomcat)

-Tim

John Poley wrote:
Please forgive my intrusion if this is not the proper place to post a
questoon of this sort.  I am new to servlets, and am working on my first
deployment- but I am running in to a problem that I can't find a solution
to.  I have installed Tomcat 5.5 and am using Eclipse (as well as a tomcat
plugin) to manage my project.   A colleague of mine sent me a war file of
out working projected, which I imported to my IDE.  I start tomcat, which
seems to load properly, and attempt to run the project on the server- where
I am faced with the following:
javax.servlet.ServletException: Servlet.init() for servlet
RequestTranslator threw exception
root cause

java.lang.NoClassDefFoundError: javax/servlet/ServletContext
        java.lang.Class.getDeclaredConstructors0(Native Method)
        java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        java.lang.Class.getConstructor0(Unknown Source)
        java.lang.Class.getConstructor(Unknown Source)

freemarker.template.Configuration.setServletContextForTemplateLoading(Config
uration.java:331)
verkoopen.boundary.UserInterfaceOutput.<init>(UserInterfaceOutput.java:31)
        verkoopen.boundary.RequestTranslator.init(RequestTranslator.java:25)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:663)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
        java.lang.Thread.run(Unknown Source)
I am using the most recent J2RE 5 and I am certain that Tomcat's
servlet-api.jar is within my application's class path.  I am not sure why
the source cannot be found.  Any helpin locating my problem would be greatly
appreciated, and I would be happy to prove more information if needed (I'm
not entirely sure what would be helpful).  And again, I am sorry if this is
not the place for this kind of question!Happy coding!John

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to