user3145373 ツ
user3145373 ツ

Reputation: 8156

Servlet Mapping not working in Google App Engine

Hi I have made an application in eclipse that is Google App Engine Project. It works fine on my localhost I have deployed it on GAE.

All Static page like login, signup pages are displayed but when I am sending request to servlet from my jsp page it shows me an error.

Suppose I have opened page login.jsp and when I click on login button it shows me an error something like :

Error: Not Found

The requested URL /Dologin was not found on this server.

I have defined all my servlet files in com package under src folder. Before this I am getting error of webservlet annotation but I have added tomcat server in my library in build path, all that error gone but now this servlet mapping error comes in.

web.xml

  <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>pj.server.GreetingServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/prj/greet</url-pattern>
  </servlet-mapping>

  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>signup.jsp</welcome-file>
  </welcome-file-list>

</web-app>

here is mt base/main page of Google app engine deployed project.

Anyone please help me.

Upvotes: 0

Views: 2933

Answers (2)

pgiecek
pgiecek

Reputation: 8220

Before this I am getting error of webservlet annotation but I have added tomcat server in my library in build path, all that error gone but now this servlet mapping error comes in.

From the above description it seems that you are using javax.servlet.annotation.WebServlet annotation to configure your environment. The annotation-based servlet configuration is supported as of servlet 3.0 specification, however, servlet API supported by App Engine is 2.5 at the time of this writing. Remove all such annotations and configure your environment by means of web.xml descriptor only.

Here you can find App Engine feature request for Servlet API 3.0.

Upvotes: 3

Vannens
Vannens

Reputation: 167

Maybe you are missing the path in the method of greetServlet. I guess greetServlet is your servlet, and inside you have foo method:

@Path("/Dologin") //add this before your method
public String foo(@Context HttpServletRequest req) {...}

Upvotes: -1

Related Questions