0

I'm trying to expose a remote interface to a spring web application, and I'm having issues, always getting 404. What's wrong with my setup below?

Grails:
services - package mypackage

class RemoteUserService implements RemoteUserServiceInterface {
    static expose = ['httpinvoker']

    User findUser(String userId) {
        return User.findByUserId(userId);
    }
}

src/groovy/mypackage

class RemoteUserService implements RemoteUserServiceInterface {
    static expose = ['httpinvoker']

    User findUser(String userId) {
        return User.findByUserId(userId);
    }
}

Spring:
mypackage

public class MyController extends AbstractController {
    RemoteUserServiceInterface remoteUserService
}

appContext

<bean id="viewController" class="mypackage.MyController">
    <property name="remoteUserService" ref="remoteUserService"/>
</bean>

<bean id="remoteUserService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    <property name="serviceUrl" value="http://localhost:8080/grails-app-name/httpinvoker/RemoteUserService"/>
    <property name="serviceInterface" value="mypackage.RemoteUserServiceInterface"/>
</bean>
2
  • (1) In your problem description, I believe you copy/pasted your service code where you should have copy/pasted your interface code. (2) Do you get a 404 error when going to 'localhost:8080/grails-app-name/httpinvoker/RemoteUserService' via your browser? Or is this just a problem when connecting using your remote MyController? Apr 9, 2011 at 19:28
  • I get a 404 if I go to this directly in the browser. The interface just defines the single method available in the service. Apr 11, 2011 at 13:18

1 Answer 1

0

You need to define a UrlMapping of

"$controller/$action?/$id?" {}

or else the plugin won't work correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.