• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Error when deploy with tomcat

 
meas chan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1744
19
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
meas chan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Furthermore, do you specify your app-context in the URL?
 
meas chan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry , i do not where is app-context , please guide me at this point
 
meas chan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not specific in app-context , i just configure it in web.xml of root in tomcat
 
J. Kevin Robbins
Bartender
Posts: 1744
19
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic