• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Servlet Error when deploy with tomcat

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Your buns are mine! But you can have this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic