Reputation: 17
I am using this tutorial to set up Tomcat Server. After I have put the HelloServlet.java
in classes and Web.xml in the WEB-INF folder and I'm giving the command
localhost:9999/hello/sayhello
On the browser. I'm always getting ClassNotFoundException
. If anyone can tell me where am I going wrong.
I'm using JDK1.6.0_30, and Tomcat7 for my sample application.
Upvotes: 0
Views: 1074
Reputation: 1016
In your 'WEB-INF' of 'classes' folder place the .class files and if your using JDBC, jsp's just Copy the .jar executable files into 'lib' folder. and make sure that xml file should contain the proper information.
you should follow below Web Application Directory Structure WEB-INF/ --
web.xml
--xml fileclasses/
---classes folder here we keep .class files Myservlet.classlib/
---lib folder here we keep all .jar files. Myapp.jar
Welcome.html Welcome.jsp
Upvotes: 0
Reputation: 453
One thing you should check is that, the HelloServlet.class should be in a package. Looks like you have a long way to go with Servlet and JSP... I recommend Head First Servlet and JSP for your reference.
Upvotes: 0
Reputation: 12538
Compile HelloServlet.java
and place the output class file HelloServlet.class
into
<TOMCAT_HOME>\webapps\hello\WEB-INF\classes\HelloServlet.class
Upvotes: 0
Reputation: 7197
You need to put the compiled HelloServlet.class
file (not the .java file) in the WEB-INF/classes
folder.
Upvotes: 1