• 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

Why is my jsp not available?

 
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I have a very small jsp-servlet application. Name of the application is myfirstwebapp. I have a folder structure like the following :
Tomcat --> webapps --> myfirstwebapp --> WEB-INF

Inside my WEB-INF, I have my classes folder and the web.xml file. Along with the web-inf folder, I also have helloworld.jsp in the myfirstwebapp folder. When I start Tomcat and type http://localhost:8080/myfirstwebapp/helloworld, the browser throws a 404 error and says "requested resource() not available"
I double checked and all names etc are correct, so its not a case of my application name being myfirstwebapp and me typing myfistwebapp....or something like that. Another thing that I found out is...if I remove the web.xml file from the project folder, the web page becomes available, but the moment I put it back, the page becomes unavailable again.
Can you please help me find out my error?

Thanks in advance for all your help.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the page is named "helloworld.jsp", then that's what you need to use in the URL, not just "helloworld".
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried even that...and yet its not able to find
 
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is the jsp located ?
can you please add a screenshot of the directory structure ?
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here are the 2 screenshots. One of them shows the directory structure till the jsp, while the other shows the error that the browser gives when I try to run the page
folder_structure.jpg
[Thumbnail for folder_structure.jpg]
Folder Structure till the jsp. The web.xml file is inside the WEB-INF folder
error.jpg
[Thumbnail for error.jpg]
This is the error that is thrown by the browser
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So http://localhost:8080/myfirstwebapp/helloworld.jsp does not work, but http://localhost:8080/myfirstwebapp/firstpage.html does?
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried after I read your post. It doesnt work. But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Souvvik Basu wrote:I tried after I read your post. It doesnt work. But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?


What you get when you access the html file?

But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?


Both should be accessible if everything is alright...
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Souvvik Basu wrote:It doesnt work. But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?


Re-read my post carefully - I was asking about firstpage.html, not helloworld.html. Reason being that the file is part of your web app.
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry...missed out that part. No, even that is not available. But as I said, it gets available (both of them) if I remove the web.xml file from the WEB-INF folder.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are there any error messages in the log files?
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It might be worth posting the web.xml file, as it sounds like the issue is probably there.
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the web.xml file



I didnt find any error messages in the log file.
I just made a fresh web application, and this time, the problem is gone. The web pages are available, even though the directory structure is same as the previous one. I'm not sure if it was a case of some internal problem with Tomcat itself.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic