Hello, I'm trying to integrate Spring into a Gwt application (using IntelliJ Idea) to use some beans or class located in the core package. Here is the application's structure [IMG]http://www.monsterup.com/image.php?url=upload/1259317243629.png[/ IMG]
I found an interresant way on http://code.google.com/p/spring4gwt/. I followed the "simple rpc example" at this page : http://code.google.com/p/spring4gwt/wiki/SimpleRPCExample. Thus i added spring libraries, gwt libraries and the spring4gwt.jar to my project and modify my files following the example. [B]WEB-INF/web.xml[/B] [CODE]<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" 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"> <!-- Spring context --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </context-param> <listener> <listener- class>org.springframework.web.context.ContextLoaderListener</listener- class> </listener> <!-- SpringGwt remote service servlet --> <servlet> <servlet-name>springGwtRemoteServiceServlet</servlet-name> <servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet</ servlet-class> </servlet> <servlet-mapping> <servlet-name>springGwtRemoteServiceServlet</servlet-name> <url-pattern>/springGwtServices/*</url-pattern> </servlet-mapping> </web-app>[/CODE] [B]ressources/applicationContext.xml[/B] [CODE]<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:component-scan base- package="biz.manex.chbah.crc.web.server" /> [/CODE] [B]client/CRCService[/B] [co...@remoteservicerelativepath("springGwtServices/crcService") public interface CRCService extends RemoteService { String sayHello(String name); }[/CODE] [B]client/CRCServiceAsync[/B] [CODE]public interface CRCServiceAsync { void sayHello(String name, final AsyncCallback<String> async); }[/CODE] [B]server/CRCServiceImpl[/B] [co...@service("crcService") public class CRCServiceImpl implements CRCService { // @Resource // private Patient myPatient; public String sayHello(String name) { return "Nom du parametre : " + name + ". Nom de la personne : " /*+ myPatient.getFirstName()*/; }[/CODE] [B]CRC.gwt.xml[/B] [CODE]<module> <!-- Inherit the core Web Toolkit stuff. --> <inherits name='com.google.gwt.user.User'/> <inherits name="com.google.gwt.i18n.I18N"/> <inherits name="com.google.gwt.http.HTTP"/> <!-- Inherit GXT --> <inherits name='com.extjs.gxt.ui.GXT'/> <!-- Specify the app entry point class. --> <entry-point class='biz.manex.chbah.crc.web.client.CRC'/> <!-- servlet --> <!--<servlet path="/springGwtServices/greetingService" class="biz.manex.chbah.crc.web.server.CRCServiceImpl"/>--> </module>[/CODE] [B]TestPanel.java[/B] (the panel who will call the rpc service [CODE]package biz.manex.chbah.crc.web.client.panels; import biz.manex.chbah.crc.web.client.CRCService; import biz.manex.chbah.crc.web.client.CRCServiceAsync; import com.extjs.gxt.ui.client.widget.LayoutContainer; import com.extjs.gxt.ui.client.widget.layout.FlowLayout; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.*; /** * Created by Manex * User: valery.stroeder ([email protected]) * Date: 12-nov.-2009 * Time: 17:07:56 */ public class TestPanel extends LayoutContainer { private VerticalPanel verticalPanel = new VerticalPanel(); private HorizontalPanel horizontalPanel = new HorizontalPanel(); private TextBox textBox = new TextBox(); private Button button = new Button("Add"); private Label label = new Label(); private AsyncCallback<String> callback; private CRCServiceAsync serviceAsync; @Override protected void onRender(Element parent, int index) { super.onRender(parent, index); setLayout(new FlowLayout()); // assemble Add Stock panel horizontalPanel.add(textBox); horizontalPanel.add(button); // create service asynchrone serviceAsync = GWT.create(CRCService.class); // ServiceDefTarget endpoint = (ServiceDefTarget) serviceAsync; // endpoint.setServiceEntryPoint("service.do"); // callback defines what to do with the service's response callback = new AsyncCallback<String>() { public void onFailure(final Throwable throwable) { System.out.println("failure"); textBox.setText("Erreur"); } public void onSuccess(final String crcServices) { textBox.setText("succes : "+crcServices); } }; // button's listener button.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent clickEvent) { serviceAsync.sayHello("val", callback); } }); // assemble main panel verticalPanel.add(horizontalPanel); verticalPanel.add(label); // add the main panel to the HTML element with the id "stockList" add(verticalPanel); // move cursor focus to the text box textBox.setFocus(true); } } [/CODE] When I launch my application and then click on the button who call the rpc-service I have this error: [CODE][WARN] Resource not found: springGwtServices/crcService; (could a file be missing from the public path or a <servlet> tag misconfigured in module biz.manex.chbah.crc.web.CRC.gwt.xml ?)[/CODE] Can someone help me ? Thanks. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
