• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

HTTP Status 404 - Servlet is not available

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags.
 
Marshal
Posts: 7266
1397
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 "
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again: please UseCodeTags
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I am running on with tomcat.
 
Christopher Meadows
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Hang a left on main. Then read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic