jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes HTTP Status 404 - Servlet is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 404 - Servlet is not available" Watch "HTTP Status 404 - Servlet is not available" New topic
Author

HTTP Status 404 - Servlet is not available

Christopher Meadows
Greenhorn

Joined: Mar 09, 2010
Posts: 7
Hello

I'm a greenhorn, so any help is greatly appreciated. I setup a website using Netbeans 6.8 for our family business using jsp, servlets, and html. On the localhost, the website works with no issues. I recently uploaded to a webserver. The html pages work fine, but the servlets do not. I think I may have a problem with the web.xml file. I stored the servlets in public_html/WEB-INF/classes/controller.

Here is the web.xml file

I amended the xml file below.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Please UseCodeTags.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3019
    
  35

Howdy Christopher,

Welcome to JavaRanch

Christopher Meadows wrote:
<servlet-class>com.classes.controller.info_FuneralServlet</servlet-class>

Are you sure that info_FuneralServlet is the exact class name and you've packaged it to the "com.classes.controller" package? Comparing to the other classes in the controller package, I think it might be something like "controller.info_FuneralServlet "


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

By the way, not following standard Java naming conventions makes your code surprisingly hard to read. "info_" is not a proper way to name a class.
Christopher Meadows
Greenhorn

Joined: Mar 09, 2010
Posts: 7
I'm sorry for improper CodeTag.

The xml file is located at public_html/WEB-INF
The servlets are located in public_html/WEB-INF/classes/controller
This an abbreviated xml file



The website loads, but the servlet is blank.
http://www.meadowsfuneralhomeinc.com

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Again: please UseCodeTags
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
So what URL are you browsing to?

Is the Servlet getting called? Can you please some System.out.println() statements into it and verify what is happening?
For that matter, are there any messages written to the application server's log file?

You're not telling us very much.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Dumb question that must be asked. You wrote:
Christopher Meadows wrote:The xml file is located at public_html/WEB-INF

public_html is usually used by the Apache web server -- you are trying to run this in Tomcat or some other Servlet engine, right?
Christopher Meadows
Greenhorn

Joined: Mar 09, 2010
Posts: 7
Yes, I am running on with tomcat.
Christopher Meadows
Greenhorn

Joined: Mar 09, 2010
Posts: 7
The /index.html does call a servlet (InfoServlet) and does a quick query and displays the information to http://www.meadowsfuneralhomeinc.com/index.jsp. In the past, I would get an 404 error when the servlet was called. Now, I get a blank page.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

What's expected? Where's the servlet code. Don't make us pull teeth, give us more info.

Have you checked to see if the servlet is running at all? (logging comes in handy)
Christopher Meadows
Greenhorn

Joined: Mar 09, 2010
Posts: 7
Here is the servlet code



I think I know what might be the problem, I changed the name on the database when I built it on the webserver. I will make the change in my code and compile. I will also reset my tomcat. I will try logging a messeage to see if my servlet is even working. Thank you for the advice. I will post my results.
Christopher Meadows
Greenhorn

Joined: Mar 09, 2010
Posts: 7
I checked the servlets by writing some test code and the servlets work. My problem must with the database connection. I will investigate further. I would like to thank everyone for their help.

Regards

Chris
Christopher Meadows
Greenhorn

Joined: Mar 09, 2010
Posts: 7
I figured out the problem, I did not have Class.forName in my java file.




It was not required in Netbeans 6.8, thank for everyone's input.

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 - Servlet is not available
 
Similar Threads
Deleting a page
web.xmi in servlets
Using Sun App Server instead of Orion
welcome-file-list
Change file name ending for JSP pages