Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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




 
Mark heningen
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 310
1
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 310
1
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, change

to

Then, how did you access the page ? http://localhost:8080/Beer-v1/form.html ?
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just take a look at your webservice (tomcat, jboss). Sometimes, tomcat takes door 8088.
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ 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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet-name tag is still not closed...
 
Rajeev Rnair
Ranch Hand
Posts: 310
1
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2450
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic