• Post Reply Bookmark Topic Watch Topic
  • New Topic

starting servlet fails  RSS feed

 
Lukas Benberg
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i got a very urgent prob here. i have a servlet,which worked. after i re-deploying the .war i cant start is anymore.

what i did:
- re-deployed project.war in tomcat
- (myServlet.class is in project/WEB-INF/classes)
- copied jdom.jar into project/WEB-INF/lib
- /usr/java/jre5.... java myServlet
- the exception thrown is:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)


thanks for your help!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lukas Benberg:

- /usr/java/jre5.... java myServlet


What is this line all about?

Are you trying to call your servlet from the command line?
 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
As mentioned by Ben,you should not run the servlet and jsp from command line.They are web appplication files,therefore should be run from browsers.
Use the deployment descriptor file(WEB-INF/web.xml)for defining servlets and its url mapping.
e.g:web.xml file
<servlet>
<servlet-name>Abc</servlet-name>
<servlet-class>Abc</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Abc</servlet-name>
<url-pattern>/xyz</url-pattern>
</servlet-mapping>




***********************************
Tip: Modesty is all virtue.
***********************************
 
Lukas Benberg
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops! indeed, i was a little confused because i also have a rmi solution for another part, which i have to start manually. alright the invokation of the servlet from the applet works.

sorry for stupid post and thanks!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!