Search code examples
gwtapache2axisgwt-rpc

Deploying GWT App with RPC calls on Apache


I'm developing a GWT app, let's say SoapCon that connects to a web service so I'm using Axis on my server-side to connect to this web service. When I run my app in development mode, it works fine (which returns xml as its response). But when I deployed my app to Apache 2.0 in Linux, RPC failed and returns 404 for the servlet mapping URL.

When I deployed this app to Apache, I recursively copied the /war/soapcon to the /var/www/html/SoapCon directory and the SoapCon.html and .css.

Here's my web.xml:

<!-- Servlets -->
<servlet>
  <servlet-name>greetServlet</servlet-name>
  <servlet-class>com.sample.google.server.SampleServiceImpl</servlet-class>
</servlet>

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

SoapCon.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='soapcon'>
....

The client side stub for the RPC service:

@RemoteServiceRelativePath("greet")
public interface SampleService extends RemoteService {
    String method( String params, ... );
}

When I run my app

http://localhost/SoapCon/SoapCon.html

the module is loaded but when I clicked a button which will call RPC method from my server, error occurs returning:

com.google.gwt.user.client.rpc.StatusCodeException: 404 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
  <title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /SoapCon/soapcon/greet was not found on this server.</p>
</body></html>

What should I do? please help. thanks in advance.


Solution

  • I assume you are running tomcat on your apache server. To deploy your gwt project you should build a .war-file, and do not try to copy all parts manually.

    The 404 error tells us, that the URL "/SoapCon/soapcon/greet" was not found / in the right place on your server. Deploying the .war instead of manual copying will automatically place everything in the right position.