• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Having troubles with Tomcat

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm plowing through Head First Servlets and JSP, but I'm having a hard time getting Tomcat to work.

Whenever I go to test a new web app on localhost, I always get the dreaded "the requested resource is not available" error report. I just want it to open a simple html file in the browser. In the webapps folder in the tomcat directory, I have a "beer" directory with a WEB-INF folder and an html file one level in. In my browser, I type in http://localhost:8080/beer/form.html which should open fine.

I have tomcat 6 and the context element in the Catalina manager file has the reloadable attribute set to true.

This is rather frustrating. My directories are right and my case is right and, yes, tomcat is running. I do reset the service everytime I make a change.

It's weird because all my practice apps did this at first too, but they randomly start working after awhile.

Any help would be welcomed. Thanks!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

a WEB-INF folder and an html file one level in


That doesn't actually tell us anything about the actual structure of your files--be specific.

If your HTML file is under WEB-INF, you won't be able to access it--the client cannot directly access anything under WEB-INF.

I do reset the service everytime I make a change.


Why?
 
Darren Gordon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a WEB-INF folder and an html file in the same folder.

I have my html file and my WEB-INF folder in the first level in. In WEB-INF, I have my web.xml dd file, an empty lib folder and the package directory for my class files (classes/com/examples/web and classes/com/examples/model).

I just assumed that anytime you make a change you should stop and restart the service.
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only need to restart the web app, not the whole server. The Tomcat Manager tool let's you start and stop apps individually.

And you don't even need to do that if all you've changed is a JSP (which will automatically redeploy).

The Manager app can also be used to see if your app is even recognized by Tomcat.
 
Darren Gordon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I haven't quite gotten to the actual server pages yet.

What are the usual common problems with that requested resource error? It's done it with sll my web apps so far, but I somehow (I don't know how) got them to work. I'm thinking it's some common newbie detail I keep forgetting.
 
Bear Bibeault
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most common errors are malformed folder structure, folders in wrong place, or invalid deployment descriptor.

Do the logs show anything?
 
Darren Gordon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where would I find said logs? I use the tomcat6w application, unless I missed something?

I apologize for being so newbie at this.
 
Bear Bibeault
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea what the "6w" means but the logs should be created in a folder in the Tomcat installation named logs.


 
Darren Gordon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I see. It couldn't parse my web.xml file. Hmm. It seems right to me though. Here's what it looks like:

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about posting the stack trace? Doesn't it *say* what the error is?
 
Darren Gordon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the issue.

Apparently it was my charset. I was using ISO, but all I did was switch to UTF-8. It works now. Why would that matter though.

By the way, to the authors of the Head First series, amazing job on these books. Everything is explained so well and the old asian martial art references, while somewhat awkward, admittedly are funny and helpful. Five stars!

Thank you for your help guys. Those logs should come in handy.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, you were using "1S0"; totally not the same. Maybe you should change your font.
 
Darren Gordon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No way, haha....I seriously did, haha. I should change it because 1's and L's look identical too.

What's the difference between IS0 and UTF-8 anyway?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://en.wikipedia.org/wiki/ISO/IEC_8859-1 (I'm assuming you meant 8859-1.)
http://en.wikipedia.org/wiki/UTF-8
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic