wood burning stoves*
The moose likes Servlets and the fly likes How should I set up the servlet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How should I set up the servlet ?" Watch "How should I set up the servlet ?" New topic
Author

How should I set up the servlet ?

Calanthe Wei
Ranch Hand

Joined: Oct 27, 2001
Posts: 42
Hi,
I am testing the code in the book "Java Developer's guide to servelt and JSP" the part of Applet and Servlet communication.
I am using JBuilder and I am totally lost what's wrong with my setting and I keep getting the error message. Pls help me with it. Thank you so much!
This is the exact code in this book.
package test515;
import com.javaranch.common.*;
// I use the package in Javaranch
// You can find it in this website
// And ObjectServlet is a servlet class in
// that package
class PipelineServlet extends ObjectServlet{
public Object doObject(Object obj){
String old = (String)obj;
String s = "";
for(int i = old.length() -1;i>=0; i--){
s+= old.charAt(i);
}
return s;
}
}
What I do is set up a project and import the com.javaranch.common package inthis project. And then use servlet wizard to write a servlet as above. The only difference is that it extends ObjectServlet instead of HttpServlet
Here is the web.xml
I think maybe there's something wrong with this
But i don't know what's it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>pipelineservlet</servlet-name>
<servlet-class>test515.PipelineServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>pipelineservlet</servlet-name>
<url-pattern>/pipelineservlet</url-pattern>
</servlet-mapping>
</web-app>
The error message is like
Error: 500 Location: /pipelineservletInternal Servlet Error:java.lang.IllegalAccessException: test515.PipelineServlet
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:268)
at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
at org.apache.tomcat.core.Handler.service(Handler.java:254)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Thank you in advance!
Calanthe
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5

That sure sounds like a file-system access problem.
Calanthe Wei
Ranch Hand

Joined: Oct 27, 2001
Posts: 42
Then what should I do to avoid this? I am quite new to this stuff. Thank you so much!
Calanthe
 
 
subject: How should I set up the servlet ?
 
Similar Threads
class not found exception in applet servlet communication
Using initParameters
HttpStatsuError
Loop issue in ExceptionHandlerServlet
Page can't displayed - problem of configuring error location with servlet name in DD