• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet DemoClass is not available

 
Neha Sinha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have created a java class "DemoClass" in netbeans.specified the servlet and servlet-mapping in web.xml.but when i run the class it shows Servlet DemoClass is not available. please help asap...
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Is the class located in the WEB-INF/classes directory? Is the class name (and the servlet name - twice) spelt correctly in the web.xml file?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DemoClass is not available.


By this you mean a ClassNotFoundException is thrown ? Perhaps the class is not loaded correctly as Ulf suggests. Did you mention the fully qualified name of the class correctly ?
 
Neha Sinha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick reply. in my web.xml i defined
<servlet>
<servlet-name>DemoClass</servlet-name>
<servlet-class>sample.js.DemoClass</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>

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

sample.js is my source package and class is located at

\DemoJsp\build\web\WEB-INF\classes\sample\js\DemoClass.class
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any error messages in the log files?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic