aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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

hany hashemi
Greenhorn

Joined: Dec 17, 2008
Posts: 14
Hi,
I have a simple class file named ControllerServlet.Whenever i put it in a default root (in src) my program run successfully. Since i put it in to a seperate package i force with this error:

"HTTP Status 404 - Servlet (control) is not available ..."

I also set the servlet parameters in web.xml.
<servlet>
<servlet-name>control</servlet-name>
<servlet-class>phoneBook.service.ControllerServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>control</servlet-name>
<url-pattern>/control</url-pattern>
</servlet-mapping>

I will appreciate it if anybody can help me.
many thanks
Hany
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What URL are you typing into the browser when trying to hit your servlet?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Originally posted by hany hashemi:
Whenever i put it in a default root (in src) my program run successfully. Since i put it in to a seperate package i force with this error:

Maybe you didn't put it in the classpath the right way.

I see a capital in your package name, phoneBook. This is unusual in Java, where package names ought to be all lowercase. Verify if anything is right, Java is case sensitive.

If that isn't the problem, then you need to make sure that the folder structure where the class is been put in conforms the package name. I.e. the class must be located at /WEB-INF/classes/phoneBook/service/ControllerServlet.class.

Don't forget to restart the appserver as well.
hany hashemi
Greenhorn

Joined: Dec 17, 2008
Posts: 14
hi,
thanks for your help.
this is a url for accessing my page:
"http://localhost:8080/control"

I put my file in this location:
web/src/phoneBook/service

Is it wrong location???!!
thanks for helping me
Hany
hany hashemi
Greenhorn

Joined: Dec 17, 2008
Posts: 14
hi again,
I should thank you alot ,i changed the capital letter in package name in to small one and it is working now.
you save me some time...:-)

Hany
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You're welcome.

One comment though:
Originally posted by hany hashemi:
I put my file in this location:
web/src/phoneBook/service

Was you talking about the .java file or the .class file? I was talking about the compiled .class file. It would explain things if you was using an IDE and didn't understood how it works "under the hood". The folder name "/src" is commonly used in IDE's to store the project's raw Java files in. You can find the compiled .class files in the "/build" folder or something straightforward like that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 - Servlet is not available