aspose file tools*
The moose likes Servlets and the fly likes Servlet Error  when deploy with tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Error  when deploy with tomcat" Watch "Servlet Error  when deploy with tomcat" New topic
Author

Servlet Error when deploy with tomcat

meas chan
Greenhorn

Joined: Mar 08, 2012
Posts: 4
when i deployed servlet in tomcat , and i put the this code as bellowed to Web.xml and and i run it in the web browser , it show error "The requested resource (/ServletProduct/product) is not available." , So what is the problem on this configure , I am sorry for this question because I am first servlet and tomcat
<servlet>
<servlet-name>My</servlet-name>
<servlet-class>hall.ThreeParam</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>My</servlet-name>
<url-pattern>/product</url-pattern>
</servlet-mapping>
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 1003
    
  13

Some things to check:

Is "ServletProduct" the correct name of your context? Remember, case counts; Servletproduct is not the same as ServletProduct.

Make sure hall.ThreeParam is the correct package and class name. Again, case matters.

Check the catalina.out file for a exception trace that might be thrown when the container tries to instantiate your servlet. Make sure the servlet doesn't have any empty catch blocks or you won't get the stack trace.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
meas chan
Greenhorn

Joined: Mar 08, 2012
Posts: 4
But when i change "/product" in <url-pattern> to "*.extesion" , it will not error while i run it on browser , what is problem ?

<servlet>
<servlet-name>My</servlet-name>
<servlet-class>hall.ThreeParam</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>My</servlet-name>
<url-pattern>/product</url-pattern>
</servlet-mapping>
Jim Pouwels
Ranch Hand

Joined: Feb 22, 2012
Posts: 61
Furthermore, do you specify your app-context in the URL?
meas chan
Greenhorn

Joined: Mar 08, 2012
Posts: 4
I am sorry , i do not where is app-context , please guide me at this point
meas chan
Greenhorn

Joined: Mar 08, 2012
Posts: 4
I did not specific in app-context , i just configure it in web.xml of root in tomcat
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 1003
    
  13

meas chan wrote:I am sorry , i do not where is app-context , please guide me at this point


The context is best described as the folder (under /webapps on Tomcat) where your application is deployed. If you are deploying with a .war file, Tomcat will create a folder with the same name as the .war file. It's also known as the document root. In your case, it appears that what you are going for is http://ServletProduct/product, in which case ServletProduct is the context.

It sounds as if you need to get some background on the basics of web application deployment. I recommend the book Head First Servlets and JSP.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Error when deploy with tomcat