Remoting Plugin

Remoting Plugin does not work with Grails 1.1 beta

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Grails 1.1-beta2, Grails 1.1-beta3, Linux, Java 6

Description

The remoting plugin does not work with Grails 1.1 beta.

I created a service:

HelloService.groovy
class HelloService implements Hello {

    boolean transactional = true
    static expose = ['hessian']

    String hallo() {
        "Hallo Welt!"
    }
}

with the interface:

Hello.groovy
public interface Hello {
  String hallo()
}

Then I used this client to call the remote service:

RemoteClient.groovy
import com.caucho.hessian.client.HessianProxyFactory

public class RemoteClient {

    public static main(args) {
        def url = "http://localhost:8080/remotetest3/hessian/HelloService"
        def factory = new HessianProxyFactory()
        def basic = factory.create(Hello.class,url)
        println basic.hallo()
    }
}

On the client side this results in:

Caught: com.caucho.hessian.client.HessianConnectionException: 500: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/remotetest3/hessian/HelloService
        at RemoteClient.main(RemoteClient.groovy:9)

with this stacktrace on the server:

Server running. Browse to http://localhost:8080/remotetest3
[1] mortbay.log /remotetest3/hessian/HelloService
javax.servlet.ServletException: No adapter for handler [org.springframework.remoting.caucho.HessianServiceExporter@1a2f279]: Does your handler implement a supported interface like Controller?
        at org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:1100)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1124)
        at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.processFilterChain(UrlMappingsFilter.java:206)
        at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInternal(UrlMappingsFilter.java:79)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.parsePage(GrailsPageFilter.java:122)
        at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:85)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.doFilterInternal(GrailsReloadServletFilter.java:101)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:65)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:828)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

The same code works fine in Grails 1.0.4

Activity

Hide
Peter Ledbrook added a comment -

I think this has something to do with the version of Spring. Unfortunately, there doesn't seem to be an easy solution available When I have the time, I'll take a look, but I can't yet.

Show
Peter Ledbrook added a comment - I think this has something to do with the version of Spring. Unfortunately, there doesn't seem to be an easy solution available When I have the time, I'll take a look, but I can't yet.
Hide
Konstantin Ignatyev added a comment -

I think I have found some clue. I have created very simple Spring project that exposes only HelloService, and is all in Java, and it works, then I created similar in Grails 1.1 and traced the difference: which is the number of handler adapters registered with the Dispatcher servlet. In case of straight Spring there are 4 of them, and the org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter is among them, and this handler handles the HessianExporter.

Grails application has only 2 adapters and HttpRequestHandlerAdapter is NOT among them, that causes the cryptic message "Does your handler implement a supported interface like Controller?"

Hope that will help fixing the bug.

Show
Konstantin Ignatyev added a comment - I think I have found some clue. I have created very simple Spring project that exposes only HelloService, and is all in Java, and it works, then I created similar in Grails 1.1 and traced the difference: which is the number of handler adapters registered with the Dispatcher servlet. In case of straight Spring there are 4 of them, and the org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter is among them, and this handler handles the HessianExporter. Grails application has only 2 adapters and HttpRequestHandlerAdapter is NOT among them, that causes the cryptic message "Does your handler implement a supported interface like Controller?" Hope that will help fixing the bug.
Hide
Konstantin Ignatyev added a comment -

Solved: Grails 1.1 need to be advised on the availability of different handlers.
The test above works if spring/resources.groovy looks like this:

import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter

beans = {

httpRequestHandlerAdapter(HttpRequestHandlerAdapter){}

}

Show
Konstantin Ignatyev added a comment - Solved: Grails 1.1 need to be advised on the availability of different handlers. The test above works if spring/resources.groovy looks like this: import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter beans = { httpRequestHandlerAdapter(HttpRequestHandlerAdapter){} }
Hide
Peter Ledbrook added a comment -

Excellent! Thanks for looking into this Konstantin - I'll try to get the fix out soon.

Show
Peter Ledbrook added a comment - Excellent! Thanks for looking into this Konstantin - I'll try to get the fix out soon.
Hide
Mirko Zeibig added a comment -

Attached a patch to fix the hessian problem.

Show
Mirko Zeibig added a comment - Attached a patch to fix the hessian problem.
Hide
John Fletcher added a comment -

Patch works, thanks.

Show
John Fletcher added a comment - Patch works, thanks.
Hide
John Fletcher added a comment -

Committed patch attached by Mirko Zeibig.

Show
John Fletcher added a comment - Committed patch attached by Mirko Zeibig.

People

Vote (2)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: