wood burning stoves 2.0*
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


JavaRanch » Java Forums » Java » Servlets
Bookmark "Running problems with Servlets" Watch "Running problems with Servlets" New topic
Author

Running problems with Servlets

Anonymous
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"
isWorkDirPersistent="false"/>
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"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>
HelloBrowser
</servlet-name>
<servlet-class>
HelloBrowser
</servlet-class>
</servlet>
</web-app>
5-i put HelloBrowser.java 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.

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
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.
Dadi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running problems with Servlets