GWT and Seam Remoting Problems
mscbug Feb 4, 2009 4:59 PMHi,
I am playing around with GWT and Seam using RPC to receive data from the server. The GWT remoting example which comes with the Seam distribution runs just fine, but when I try to make a RPC call I get this error.
The requested resource (/seam/resource/gwt) is not available.
I use:
Seam 2.0.1.GA
JBoss 4.2.2.GA
gwt-mac-1.5.3
My files:
The synchron interface:
public interface ReportingService extends RemoteService { public ReportingDTO getReportingData(); }
The asynchron interface:
public interface ReportingServiceAsync extends RemoteService { public void getReportingData(AsyncCallback<ReportingDTO> callback); }
my interface inplementation:
@Name("at.foo.mts.view.gwt.client.ReportingService") public class ReportingServiceImpl implements ReportingService { @WebRemote public ReportingDTO getReportingData() { ReportingDTO dto = new ReportingDTO(); dto.setName("test"); return dto; } }
my web.xml (the remoting part):
... <servlet> <servlet-name>Seam Resource Servlet</servlet-name> <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Seam Resource Servlet</servlet-name> <url-pattern>/seam/resource/*</url-pattern> </servlet-mapping> ...
I compile the gwt client code and copy the output during deployment to the root folder of the exploded war. The folder structure of the ear looks like this:
mts.ear jboss-seam.jar lib ... mts.war foo.xhtml foo.xml reporting.html ... all js files compiled by the gwt compiler ...
after deployment and starting the server I can run the app in hosted mode and in the browser.
http://localhost:8080/mts/reporting.html
All looks pretty good, but when I try to make a RPC call, the error described above occurs. (resource not found)
The lookup for the reporting service looks like this:
private ReportingServiceAsync getReportingService() { ReportingServiceAsync rs = (ReportingServiceAsync) GWT.create(ReportingService.class); ServiceDefTarget endpoint = (ServiceDefTarget) rs; String endpointURL = GWT.getHostPageBaseURL() + "seam/resource/gwt"; endpoint.setServiceEntryPoint(endpointURL); return rs; }
For the String endpointURL I tried all kinds of combinations, but no one worked. When you see the code, it looks pretty much like the gwt example in the seam examples remoting package, there it works, in my case not, and I have no clue why.
Although I am new to Seam, to me it looks like the endpointURL is not handled by the seam resource servlet.
I hope anyone can help.
Thanks in advance, markus