Note that there are some explanatory texts on larger screens.

plurals
  1. POClassLoader problem when using GWT RequestFactory with Grails
    text
    copied!<p>In order to get GWT RequestFactory running with Grails, I am using the following approach:</p> <pre><code>class GwtController extends RequestFactoryServlet { public GwtController() { super() } def index = { doPost request, response } @Override public ServletContext getServletContext() { return ServletContextHolder.servletContext } @Override public ServletConfig getServletConfig() { return new DummyServletConfig(getServletContext(),"grails"); } } </code></pre> <p>where DummyServletConfig is a simple implementation of <code>ServletConfig</code></p> <p>This is working when deploying the app to tomcat. However, using testing or development mode, it is not. I was required to adjust the GWT Servlet in order to prevent it from using the wrong Class Loader:</p> <p>In line 46 I changed</p> <pre><code>private static final RequestFactoryInterfaceValidator validator = new RequestFactoryInterfaceValidator(log, new RequestFactoryInterfaceValidator.ClassLoaderLoader( ServiceLayer.class.getClassLoader())); </code></pre> <p>to</p> <pre><code>private static final RequestFactoryInterfaceValidator validator = new RequestFactoryInterfaceValidator( log, new RequestFactoryInterfaceValidator.ClassLoaderLoader( Thread.currentThread() .getContextClassLoader())); </code></pre> <p>Otherwise, it wouldn't find my Domain classes (which apparently do not reside in the GrailsRootLoader but in the Thread's class loader).</p> <p>Now I would like to revert my GWT servlet to the official binary released by Google and I wonder how I can fix the incorrect ClassLoader in Grails or make the RequestFactoryServlet work correctly without altering the GWT source.</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