This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes Running problems with Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Running problems with Servlets" Watch "Running problems with Servlets" New topic

Running problems with Servlets

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi All
i'm trying to run a servlet using Tomcat.
what i did:
1-i put this code in server.xml
<Context path="/mytest" docBase="webapps/mytest"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
2- i create mytest directory under jakarta-tomkat/webapps
3- i create WEB-INF directory under mytest.
4- i create web.xml file and i save it in WEB-INF directory ,web.xml has:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
5-i put and HelloBrowser.class in directory i called (classes ) under WEB-INF
6- i restart tomcat
7- i point my browser to: http://localhost:8080/mytest/servlet/HelloBrowser
i got this message:
server error the proxy has encountered an internal error.....
i do appreciate your time and your help,it is really hard for me to figureout what is the problem,but soon i run the first servlet it will be easy for me.
thanks alot.

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I think it is better to use the default Directories of Tomcat instead of creating the Dir again. Just make sure you set the JAVA_HOME & TOMCAT_HOME dir. You may also look into the doc of Tomcat for setting this.
Also make sure the servlet.jar files are in your classpath. The java source file should be saved under the JDK bin directory. After compiling the program the Class should be made available in the Tomcat.
Also for invoking the servlet you should use http://localhost:8080/servlet/HelloBrowser.
I agree. Here's the link:
subject: Running problems with Servlets
It's not a secret anymore!