I have written a simple hello world app using Spring and an ANT script to generate JAR file for the hello world app. The JAR is getting generated and the classes are getting compiled properly. I then copied the JAR into my tomcat webapps folder, started tomcat and loaded the index.jsp page. When i tried to navigate from the index.jsp page my Servlet inside the JAR is not getting recogonized. it throws the below given exception.
can someone please tell me why my Servlet class is not getting recogonized?
my directory structure is
my build.xml is
i tried creating JAR using eclipse. This also gives errors.
can someone help, please?
this is the structure of the jar that is being generated.
Getting errors during build time is no good. But you can easily check what's in the jar file being generated: run "jar -tf helloworld.jar" on the command line. If the servlet is not in there, or not with the correct class name, you know where to start looking.
A quick glance at the build file shows that the value of the "main-class" property is apparently incorrect.
I haven't analyzed how it's used - presumably you would know that. I just noticed that its value is "/my/hello/WelcomeServlet.class" whereas later on you mention a class named "my.hello.servlet.WelcomeServlet" - are those supposed to refer to the same class?