The Artima Developer Community
Sponsored Link

Java Answers Forum
newbie Servlet Help

1 reply on 1 page. Most recent reply: Feb 17, 2003 6:31 PM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
mansoor

Posts: 7
Nickname: mansoor
Registered: Jul, 2002

newbie Servlet Help Posted: Feb 17, 2003 6:00 PM
Reply to this message Reply
Advertisement
hello,
I have just started servlet programming and i am having a really tough time with Tomcat. My servlets compile fine but i try to open it with a browser i get weird error. could you please have a look and tell me what i am doing wrong here

**********************servlet************************
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class pinky extends HttpServlet {



public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {


PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Servlet Testing</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("This is a lame first servlet");
out.println(java.util.date());
out.println("</BODY>");
out.println("</HTML>");
}


}
********************************************************


************** ************Error***********************

-------------------------------------- ------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error instantiating servlet class pinky
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:911)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:666)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 214)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnecti on(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:5 30)
at java.lang.Thread.run(Thread.java:536)


root cause

java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class pinky with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
at java.lang.Class.newInstance0(Class.java:300)
at java.lang.Class.newInstance(Class.java:259)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:902)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:666)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 214)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnecti on(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:5 30)
at java.lang.Thread.run(Thread.java:536)
***************************************** ******************


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: newbie Servlet Help Posted: Feb 17, 2003 6:31 PM
Reply to this message Reply
Your code looks fine.
Suspect it is the url string you are entering in your browser.
Try saving the .class file in the same file folder as the example servlets. This is under the webapps/examples/WEB_INF/classes folder.

and then attempt running it using a url string similar to one of the examples.

Flat View: This topic has 1 reply on 1 page
Topic: How to set Main to access methods Previous Topic   Next Topic Topic: NoClassDefFoundError

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use