Note that there are some explanatory texts on larger screens.

plurals
  1. POGuice and GWT problem - can't find GWT.rpc
    text
    copied!<p>I build a simple contact manager app with simple service and it did work. Then I decided I want to use Guice for managing my services and implementations. I also use mvp4g plugin for MVP design pattern. I followed the exmaple of Eric Burke on his <a href="http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/" rel="nofollow noreferrer">blog</a>, and my code looks like that:<br> ContactService.java</p> <pre><code>@RemoteServiceRelativePath("GWT.rpc") public interface ContactService extends RemoteService { public void saveContact(Contact c); public List&lt;Contact&gt; listContacts(); } </code></pre> <p>ContactServletModule.java:</p> <pre><code>@Singleton public class ContactServletModule extends ServletModule{ private static String SQL_MAP_CONFIG = "org/yuri/SqlMapConfig.xml"; private SqlSessionFactory factory = null; @Provides public SqlSessionFactory getSqlSessionFactory(){ if(this.factory == null){ try { /* * Create new factory */ Reader r = Resources.getResourceAsReader(SQL_MAP_CONFIG); this.factory = new SqlSessionFactoryBuilder().build(r); } catch (IOException ex) { /* * do nothing, factory is null still */ } finally{ return this.factory; } } else{ return this.factory; } } @Override protected void configureServlets() { serve("/YuriContactManager/GWT.rpc").with(GuiceRemoteServiceServlet.class); bind(ContactService.class).to(ContactServiceImpl.class); } } </code></pre> <p>MyGuiceContextListener.java</p> <pre><code>public class MyGuiceContextListener extends GuiceServletContextListener { @Override protected Injector getInjector() { return Guice.createInjector(new ContactServletModule()); } } </code></pre> <p>But when when I start my app and try to list contacts by calling listContacts(), tomcat tells me that GWT RPC can't be found (exactly: The requested resource (/YuriContactManager/org.yuri.ContactManager/GWT.rpc) is not available.) My web.xml looks like that:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app version="2.5" 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"&gt; &lt;filter&gt; &lt;filter-name&gt;guiceFilter&lt;/filter-name&gt; &lt;filter-class&gt;com.google.inject.servlet.GuiceFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;guiceFilter&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;listener&gt; &lt;listener-class&gt;org.yuri.server.MyGuiceContextListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;welcomeGWT.html&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;/web-app&gt; </code></pre> <p>Any one had similar problem or has any idea what might be wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload