aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes  error for first web application : The requested resource (/Beer-v1/SelectBeer.do) is not available. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark " error for first web application : The requested resource (/Beer-v1/SelectBeer.do) is not available." Watch " error for first web application : The requested resource (/Beer-v1/SelectBeer.do) is not available." New topic
Author

error for first web application : The requested resource (/Beer-v1/SelectBeer.do) is not available.

Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

hello everyone
this is my first post in the SCWCD forum
feels great to have passed SCJP

I started studying for SCWCD from HFSJ

I am trying the first tutorial that is given in the book but I am not able to run the servlet
I corrected some mistakes I had made while developing and deploying application but still not able to remove error
the information is as follows

Development structure
MyProjects -> beerV1 -> classes -> com -> example -> web -> BeerSelect.class
|------> etc -> web.xml
|------> lib
|------> src -> com -> example -> web -> BeerSelect.java
|------> web -> form.html

and the deployment structure is as follows
tomcat ->webApps -> Beer-v1 -> WEB-INF -> classes -> com -> example -> web -> BeerSelect.class
|
|-------> form.html(this is in Beer-V1 directory, due to some reason formatting here is not right )

and also the xml and source files are as follows
xml file


and the source file is



HTML



I know this is such a long post but I need help really bad
I am very excited to go for further application development but cannot continue without it





SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Mark heningen
Greenhorn

Joined: Mar 25, 2010
Posts: 25
Please add the contents of your html file. i guess you entered some wrong value in action.
it should be:


and web.xml file must be under ..\webapps\Beer-v1\WEB-INF\
Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

Hi Prasad, have you copied the web.xml to your deployment folder (Beer-v1/WEB-INF) ? Please confirm.
Also in the form.html (or form) make sure you add method ="POST" because the default is GET and you have implemented only doPost method


SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

extremely sorry I forgot to add the HTML code in the post above
I have edited it
every file is in right place (I've double checked)
I get the web page displayed so that is not the problem
but
when I click the "submit" button on the page then we get the error
please help


please anyone describe what exactly these errors mean
so that I will be able to look into it deeply

the errors are as follows




type Status report

message /Beer-v1/SelectBeer.do

description The requested resource (/Beer-v1/SelectBeer.do) is not available.
Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

Can you please make sure that the default servlet examples (in tomcat) is running?
go to http://localhost:8080/servlets-examples/ and click execute in the Hello World servlet?

Thanks,
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

First of all, change

to

Then, how did you access the page ? http://localhost:8080/Beer-v1/form.html ?


[My Blog]
All roads lead to JavaRanch
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

corrected the mistake but still it is not working
I will try to re-create the application and then will ask if any problem occurs
thank you Christophe

Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Just take a look at your webservice (tomcat, jboss). Sometimes, tomcat takes door 8088.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

@ herbert
that does not work

well I build the application again and I don't think there is any mistake regarding code
because I have just took the code from HFSJ book

the code is as follows and the directories are right and files are in the right place

HTML code


This is java code ... it compiled fine and the servlet is in right place in both environments


and finally the xml code is



I am sure that problem is with XML but cannot figure out
please help I need it ......

the HTML page is displayed so I don't think that problem is with tomcat

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The servlet-name tag is still not closed...
Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

Christophe Verré wrote:The servlet-name tag is still not closed...

Christophe is right. Please take care of the <servlet-name> in <servlet-mapping>

Which version of Tomcat are you using? Better to use Tomcat 5.5
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Rajeev Rnair wrote:
Christophe Verré wrote:The servlet-name tag is still not closed...

Christophe is right. Please take care of the <servlet-name> in <servlet-mapping>

Which version of Tomcat are you using? Better to use Tomcat 5.5


Indeed. Im facing some problemas with tomcat 6. Go to with the 5.5. You will find more help for it at the web.
Pj Gen
Greenhorn

Joined: Feb 06, 2011
Posts: 1
Sorry to revive this thread but I was also facing the same problem. Solved it but replacing the first part of the web.xml file with the most recent one. I'm currently using tomcat 7. Hope this helps.
Darren Littlepage
Ranch Hand

Joined: Dec 27, 2010
Posts: 35
I'm using Tomcat 6 and I have to change the examples in the web.xml to look like this:



That helps it. I also had problems. I'm not sure what error you are getting but I had to set CATALINA_HOME environment variable on Windows 7.


OCPJP for Java 6 on 01/2011
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1696
    
  25

Hi Pj,

This works on Tomcat 7, the header of the web.xml looks slightly different from yours:


The Servlet

and the html file


And the URL:
http://localhost:8080/JavaEE6Project/Form.html

Regards,
Frits
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: error for first web application : The requested resource (/Beer-v1/SelectBeer.do) is not available.