• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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




 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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\
 
Ranch Hand
Posts: 310
1
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The servlet-name tag is still not closed...
 
Rajeev Rnair
Ranch Hand
Posts: 310
1
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic