File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Been troubleshooting for 3 days: Servlet doesn't work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Been troubleshooting for 3 days: Servlet doesn Watch "Been troubleshooting for 3 days: Servlet doesn New topic

Been troubleshooting for 3 days: Servlet doesn't work

Moe Cosby

Joined: Dec 10, 2010
Posts: 3
I am new to JSP/Servlet scene but I have been in I.T field for good couple of years.
For the end of me - I cannot run HELLO WORLD servlet on Tomcat 7

I been suspecting that its illconfigured web.xml file - hence I have tried many HELLO WORLD servlet and they don't work either

Although builtin example works.

For code + exact error details - lets just say this one is exactly describing my issue but it is not working:

I can compile it successfully and I can open it through tomcat.

I have tried importing WAR files - doesn't work
Created new files - doesn't work
Copied other people's project - doesn't work

Any help is appreciated.

Note - this is local development environment. A lot of time it is not connected to internet either. Security is not a concern.
binu narayanan
Ranch Hand

Joined: Jul 24, 2009
Posts: 60

If the address in your browser is some thing like this http://localhost:8084/myservlet. This url would like this if you are using Netbeans IDE.

Then changing the code in your jsp from <FORM action="/myServlet" method="GET"> to

<FORM action="[YOUR PROJECT NAME]/myServlet" method="GET">

will help you call your servlet

Binu Narayanan
Lester Burnham

Joined: Oct 14, 2008
Posts: 1337
"it doesn't work" is not a helpful problem description - see ItDoesntWorkIsUseless and TellTheDetails.

You could also check out how the examples in the "servlets-examples" web app work that comes with Tomcat.
Moe Cosby

Joined: Dec 10, 2010
Posts: 3

As I mentioned in my original post (see the link for details of code + error) - My problem is EXACTLY the same.

but my solution is not.

@Binu - I will try that and report back on Monday.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

"Prince Ms", please check your private messages for an important administrative matter. Thanks.

[Asking smart questions] [About Bear] [Books by Bear]
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 662

In that link, they also tell that the problem is solved.. Can, you please tell the exact details of your problem.. I wonder why can't you tell your problem with your code here, instead of showing us the link.. this also helps to get more responses to your question..
Chetan Natu

Joined: Dec 03, 2005
Posts: 19
Have you tried by dropping the "/" in the Form action? I think this will work...

Never Remember the failure
Never Forget the mistake
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

If you want, in my signature there is a tutorial for hello world with servlet.

It might help you.

[] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Moe Cosby

Joined: Dec 10, 2010
Posts: 3
Thanks everyone. Mark this as resolved.

Removed all tomcat(s). Reinstalled tomcat 7. Checked all paths. Recreated all files from scratch in notepad (no copy paste). Working now.

[Although Servlet are more powerful - I prefer Microsoft ASP, you end up spending more time in developing solution than learning / troubleshooting :s ]
I agree. Here's the link:
subject: Been troubleshooting for 3 days: Servlet doesn't work
It's not a secret anymore!