Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Running problems with Servlets

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic