• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

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

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not a resource in the container. Resources are HTML files, jsp pages, Servlets, etc.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And not a Tomcat question really, moving..
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.


 
Ranch Hand
Posts: 607
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet classess should be in package.
Place the servlets in a proper package and then test.
 
Ramm Kummar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 607
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 607
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ 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!

 
Sheriff
Posts: 67389
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Cloud Walker", please check your private messages for an important administrative matter.
 
Shin Kudo
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[duplicate removed]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic