Reputation: 9444
Can some one help me with this problem. jetty is not able to find my servlet. :(
I am getting the following error-
This is my directory structure -
This is my Web.xml -
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>loginSer</servlet-name>
<display-name>loginSer</display-name>
<description></description>
<servlet-class>launchpad.servlets.loginSer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>loginSer</servlet-name>
<url-pattern>/loginSer</url-pattern>
</servlet-mapping>
</web-app>
Upvotes: 0
Views: 407
Reputation: 8606
Your exception reads com.launchpad.servlets.LoginServlet
but your class is launchpad.servlets.LoginSer
Are you sure that you're showing the accurate exception and source-code hierarchy?
Upvotes: 0
Reputation: 240900
You kept it in wrong directory, it should go under
src/main/java
not in
src/main/resource
Maven takes into compilati
Update
when I add it to /src/main/java eclipse cannot import HttpServlet class.
It is because you don't have servlet-api in yoru classpath
add dependency to your POM, replace ${servlet-api-version}
with the appropriate version matching your app environment
dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api-version}</version>
</dependency>
Upvotes: 3