Issue Details (XML | Word | Printable)

Key: GRAILSPLUGINS-865
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Peter Ledbrook
Reporter: Mirko Zeibig
Votes: 2
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Grails Plugins

Remoting Plugin does not work with Grails 1.1 beta

Created: 12/Feb/09 02:15 AM   Updated: 30/Jun/09 02:48 PM
Return to search
Component/s: Grails-Remoting
Affects Version/s: Grails-Remoting 1.0
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. File remoting.diff (0.8 kB)

Environment: Grails 1.1-beta2, Grails 1.1-beta3, Linux, Java 6


 Description  « Hide

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



Peter Ledbrook added a comment - 14/Feb/09 02:58 PM

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.


Konstantin Ignatyev added a comment - 17/Mar/09 08:13 PM

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.


Konstantin Ignatyev added a comment - 17/Mar/09 09:50 PM

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){}

}


Peter Ledbrook added a comment - 18/Mar/09 01:36 AM

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


Mirko Zeibig added a comment - 30/Jun/09 02:48 PM

Attached a patch to fix the hessian problem.