Mr. Adobo
Mr. Adobo

Reputation: 825

Error trying to call method from server on GWT

I'm trying to call a method from my server side whose signature is

public Integer method()

but when I redid all the steps used on the StockWatcher tutorial to call it, I'm getting a 404 error which says this is the URL

<p>RequestURI=/com.medtronic.empattendance.EmployeeAttendance/empQueries</p>

I'm not sure what the correct URL should be, but this is the incorrect URL.

my web.xml says this on servlets

<servlet>
    <servlet-name>empQueryServerImpl</servlet-name>
    <servlet-class>com.medtronic.empattendance.server.EmpQueryServerImpl</servlet-class>
</servlet>

  <servlet-mapping>
    <servlet-name>empQueryServerImpl</servlet-name>
    <url-pattern>/empattendance/empQueries</url-pattern>
  </servlet-mapping>

Where am I going wrong?

Upvotes: 1

Views: 66

Answers (2)

MarioP
MarioP

Reputation: 3832

There is an alternative: Use the @RemoteServiceRelativePath (javadoc) annotation on your RPC class (The interface extending RemoteService, not the Async one).

Assuming your GWT app is /empattendance:

@RemoteServiceRelativePath("empQueries")
public interface EmpQueryServer extends RemoteService {
    // your methods
}

Upvotes: 1

Mr. Adobo
Mr. Adobo

Reputation: 825

I have solved it:

I had <url-pattern>/empattendance/empQueries</url-pattern> which was based off the tutorial, but digging deeper I found out I needed to use the full package name.

<url-pattern>/com.myCompany.empattendance.EmployeeAttendance/empQueries</url-pattern>

Upvotes: 0

Related Questions