Arvind
Arvind

Reputation: 6474

404 error in gwt project- servlet is correctly defined in web.xml but still getting 404 error

I am working to create a web app using GWT+Java backend. The host page is "App.html" The app also has a RPC, and the host page when initially loaded, makes an RPC call.

However this is the message I am getting from Javascript console in Google Chrome browser-

POST http://app.sparkcrawler.com/com.arvindikchari.auth.App/AuthenticationService 404(Not Found) 

Given below are the contents of my web.xml--

<?xml version................................>
    <servlet>
    <servlet-name>AuthenticationService</servlet-name>
    <servlet-class>com.arvindikchari.auth.server.AuthenticationServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>AuthenticationService</servlet-name>
    <url-pattern>/com.arvindikchari.auth.App/AuthenticationService</url-pattern>
</servlet-mapping>

What am I doing wrong here? How do I resolve this error?

Upvotes: 0

Views: 323

Answers (2)

Hardik Mishra
Hardik Mishra

Reputation: 14897

The problem is with your servlet mapping.

Basically, you have two things in web.xml (regarding servlets):

  • the <servlet> tag, which defines the alias for the servlet, and its fully-qualified name (In your case AuthenticationService and com.arvindikchari.auth.server.AuthenticationServiceImpl)

    the <servlet-mapping> which specifies a url-pattern for a given alias (taken from the <servlet> definitions).

It should be like

<servlet-mapping>
    <servlet-name>AuthenticationService</servlet-name>
    <url-pattern>/authenticationService</url-pattern>
</servlet-mapping>

Upvotes: 1

Mayank Pandya
Mayank Pandya

Reputation: 1623

I think your servlet mapping url pattern looks wrong.

normally when mapping any servlet <url-pattern> would be like this.

<`<url-pattern>/{app name}/{servlet name}</url-pattern>`

here app name would be same as registered app name which is in gwt.xml file.

Upvotes: 0

Related Questions