could not access HTTP invoker remote service

vr3w3c9 picture vr3w3c9 · Feb 24, 2014 · Viewed 17.6k times · Source

Im using Spring and im trying to access a HTTP invoker remote service and have specified the url in the spring-http-client-config.xml. But Im getting the below exception

org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [http://blr1272d:8080/MaskOracle/remoting/securityService]; nested exception is java.io.IOException: Did not receive successful HTTP response: status code = 401, status message = [Unauthorized]

The configuration details that I have specified in the spring-http-client-config.xml are below

    <bean id="securityService"
      class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    <property name="serviceUrl" value="http://blr1272d:8080/MaskOracle/remoting/securityService" />
    <property name="serviceInterface" value="com.him.mask.security.remote.service.SecurityService" />
    <property name="httpInvokerRequestExecutor" ref="httpInvokerRequestExecuter"/>

</bean>
 <bean id="httpInvokerRequestExecuter"  
 class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" /> 

Im not sure why im getting this exception. Please help me in resolving the issue. Thanks

Answer

m-szalik picture m-szalik · Feb 24, 2014

It looks like your service at http://blr1272d:8080/MaskOracle/remoting/securityService requires authentication but your securityService doesn't use any credentials.

Try to use org.springframework.richclient.security.remoting.BasicAuthCommonsHttpInvokerProxyFactoryBean and set authenticationToken property.