aspose file tools*
The moose likes Servlets and the fly likes Servlet DemoClass is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet DemoClass is not available" Watch "Servlet DemoClass is not available" New topic
Author

Servlet DemoClass is not available

Neha Sinha
Greenhorn

Joined: Jul 08, 2009
Posts: 3
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
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
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

Joined: Feb 24, 2006
Posts: 6662
    
    5

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 ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Neha Sinha
Greenhorn

Joined: Jul 08, 2009
Posts: 3
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
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
Are there any error messages in the log files?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet DemoClass is not available