Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Requested resource not available error

 
Chithra Samy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am very new to servlet concept..I installed tomcat 5.0 and i have jdk 1.5..

I have set all the variables CLASSPATH,JAVA_HOME,CATALINA_HOME...
and i compiled the HelloWorldServlet program in deshmukh book and got the class file also..

I kept the class file in the following path Tomcat 5.0\webapps\Test\WEB-INF\classes\HelloWorldServlet.class

I have kept the web.xml in the following path Tomcat 5.0\webapps\Test\WEB-INF

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>
</web-app>


And when i try the following through the browser http://127.0.0.1:8080/Test/servlet/HelloWorldServlet
I am getting request resource not available error..

But i was able to execute the servlet examples already present through the browser http://127.0.0.1:8080/servlet-examples/servlet/HelloWorldExample

Can anyone guide me in this.

Thnx in advance.
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should mention the url-pattern for your servlet.modify your web.xml as,

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/Hello</url-pattern>
</servlet-mapping>
</web-app>

Now try,
http://127.0.0.1:8080/Test/Hello
 
Sathish Nagappan
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Balasubramani , I am just curious about the career scope of SCWCD and SCJP ?? Where are you working rite now,If you dont mind to answer ??
 
Chithra Samy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi balasubramani,

Thnx a lot for ur reply.. My problem got solved..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic