File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes The requested resource (/Beer-V1/) is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The requested resource (/Beer-V1/) is not available" Watch "The requested resource (/Beer-V1/) is not available" New topic
Author

The requested resource (/Beer-V1/) is not available

Ramm Kummar
Greenhorn

Joined: Feb 10, 2009
Posts: 26
I am getting this error while trying to open a page from the application. I have created all the required deployment folders and defined the servlet in the web.xml too. Please suggest me here.

Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
That's not a resource in the container. Resources are HTML files, jsp pages, Servlets, etc.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

And not a Tomcat question really, moving..


SCJP, SCWCD.
|Asking Good Questions|
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


Hi,

This will shows you are not getting resource for request.

Either you make folder in your deployment environment or you have to change it in web.xml mapping of your servlet for particular request.




Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

Ramm Kummar wrote:I am getting this error while trying to open a page from the application. I have created all the required deployment folders and defined the servlet in the web.xml too. Please suggest me here.



We'll some thing has gone wrong with your deployment - either the mapping is not correct or the deployment might have failed. Try to follow the deployment steps again - If it still does not work you might have to post step wise everything that you are doing.


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Shin Kudo
Greenhorn

Joined: Apr 17, 2009
Posts: 25
Edit: Oops, I got it working now. I figure that maybe there're some typos (with the xml's header, i guess) in my original web.xml (I typed it from the book). But I copy the xml's header from other web.xml file and the problem was solved.


I also got problem with making Tomcat to run my first servlet. I follow the steps in the Chapter 1 of Head First Servlets and JSP, 2nd ed. But I only got the message:



Here are what I did:
- compiled and put Ch1Servlet.class into webapps\ch1\WEB-INF\classes
- created web.xml and put it into ch1\WEB-INF\ (I guess nothing's wrong with this file)

- run the servlet with http://localhost:8080/ch1/Serv1 and got the error message above

However, I put my Ch1Servlet.class into webapps\servlets-examples\WEB-INF\classes and added these entries:

into the webapps\servlets-examples\WEB-INF\web.xml then http://localhost:8080/servlets-examples/Serv1 and everything runs fine.

I don't know what went wrong here. For now, I have to put all my .class files in webapps\servlets-examples\WEB-INF\classes and modify the web.xml to make them work.


SCJP 6 - SCWCD in progress...
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Servlet classess should be in package.
Place the servlets in a proper package and then test.
Ramm Kummar
Greenhorn

Joined: Feb 10, 2009
Posts: 26
you have to add the C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\Beer\WEB-INF\classes\ directory to the classpath.
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Ramm Kummar wrote:you have to add the C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\Beer\WEB-INF\classes\ directory to the classpath.


Why you want to do that?
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

Ramm Kummar wrote:you have to add the C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\Beer\WEB-INF\classes\ directory to the classpath.


You have to do no such thing. The container takes care of everything inside your webapps folder!
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

@ Cloud Walker - You sure you got all your cases right? You could try one thing out. Place a simple 'hello word' html file @ webapps\ch1\.
Try accessing the hello world file (lets call it helloWorld.html) using the link --> http://localhost:8080/ch1/helloWorld.html. Does it work?

You could also try Mohamed Inayath suggestion of putting your class in a package - it sometimes cause problems if you don't place your servlet code in a package - though i am not sure why!

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

"Cloud Walker", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shin Kudo
Greenhorn

Joined: Apr 17, 2009
Posts: 25
Sam Mercs wrote:@ Cloud Walker - You sure you got all your cases right? You could try one thing out. Place a simple 'hello word' html file @ webapps\ch1\.
Try accessing the hello world file (lets call it helloWorld.html) using the link --> http://localhost:8080/ch1/helloWorld.html. Does it work?

You could also try Mohamed Inayath suggestion of putting your class in a package - it sometimes cause problems if you don't place your servlet code in a package - though i am not sure why!



Everything's alright now. Thank you!
Krzychu Montana
Greenhorn

Joined: Oct 17, 2009
Posts: 4
[duplicate removed]
Devendar Rao
Greenhorn

Joined: Jan 14, 2010
Posts: 1
Run into same problem: 404 error
A quick fix
1. Trust the instruction given in book and please place your files in corresponding folders
2. Make sure you are using tomcat version 5.x mine is 5.5.28 ...( apart from other complexity while compiling servlet by javac the classpath to needed libraries are different on version 6.x)
3. If you cannot see anything except 404. TYPO ERROR is main culprit especially in web.xml
A quick check
a. can you see the form in browser when you type http://localhost:8080/Beer-v1/form.html
b. If no just remove or rename web.xml try again after running shutdown.sh and startup.sh
---if you can see then chances are high that you have some typo in web.xml
A quick fix:
go to ----/apache-tomcat-5.5.28/webapps/ROOT/WEB-INF and copy web.xml and put it in
/apache-tomcat-5.5.28/webapps/Beer-v1/WEB-INF and edit following 4 lines in web.xml


<servlet-name>Ch3Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>

<servlet-name>Ch3Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>

try again after running shutdown.sh and startup.sh

4. may be you can see the form but pressing submit gives nothing----if you are sure you have compiled and put class in appropriate directories -- then possible culprit is a typo error in form.html---check the following line it must be
action="SelectBeer.do">

5. file permissions---i am linux user--never find any probs with file permission in this case---please dont mess with it...default is ok...

simple solution are best solutions
William Asher
Greenhorn

Joined: Jul 23, 2009
Posts: 25
Ran into same problem doing the exercise in chapter 3 of Head First Servlets & JSP.

Solution:

1) Pull all hairs out
2) Do what Devender Rao and Shin Kudo said (mainly look for, find, and correct typos in web.xml)
3) Successful deployment of the Beer Selection web app.

Thanks Javaranch!

William Asher


 
 
subject: The requested resource (/Beer-V1/) is not available
 
Similar Threads
Unable to run Servlets using Tomcat
Help with Head first sample code
HTTP Status 404 - /Beer-v1/form.html
Head First Servlets and JSP
first program error, something is missing