This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 39535
    
  27
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?


Ping & DNS - updated with new look and Ping home screen widget
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    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: 39535
    
  27
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
 
Similar Threads
SCEA part 1 exam
Object Class
want to implement sorting logic in my project with jsf
Accessing servlet
web.xml tag problem