Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Been troubleshooting for 3 days: Servlet doesn't work

 
Moe Cosby
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: http://www.daniweb.com/forums/thread186788.html

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
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
^ LOL

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
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Prince Ms", please check your private messages for an important administrative matter. Thanks.
 
Prasad Krishnegowda
Ranch Hand
Posts: 667
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried by dropping the "/" in the Form action? I think this will work...
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want, in my signature there is a tutorial for hello world with servlet.

It might help you.

 
Moe Cosby
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic