title: HttpInvokerServiceExporter + HttpInvokerProxyFactoryBean - Could not access HTTP invoker remote service
body: <p>I'm trying to use HttpInvokerServiceExporter + HttpInvokerProxyFactoryBean, but whatever I do I get an exception:</p>
  
  <pre><code>org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [http://localhost:9999/testcaseapp/testcaseservice]; nested exception is java.io.IOException: Did not receive successful HTTP response: status code = 404, status message = [Not Found]
  </code></pre>
  
  <p>For the simplicity, I've created a test case.</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration
  public class RemoteTest {
  
      private static final Logger logger = LoggerFactory.getLogger("TestsLogger");
  
      static interface TestCaseService {
          public Integer add(Integer arg1, Integer arg2);
      }
      static class TestCaseServiceImpl implements TestCaseService {
          public Integer add(Integer arg1, Integer arg2) {
              return (arg1 != null ? arg1.intValue() : 0) + (arg2 != null ? arg2.intValue() : 0);
          }
      }
  
      @Configuration
      static class Config {
          @Bean
          public HttpInvokerServiceExporter httpInvokerServiceExporter() {
              HttpInvokerServiceExporter httpInvokerServiceExporter = new HttpInvokerServiceExporter();
              httpInvokerServiceExporter.setService(new TestCaseServiceImpl());
              httpInvokerServiceExporter.setServiceInterface(TestCaseService.class);
              return httpInvokerServiceExporter;
          }
          @Bean
          public HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean() {
              HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
              httpInvokerProxyFactoryBean.setServiceInterface(TestCaseService.class);
              httpInvokerProxyFactoryBean.setServiceUrl("http://localhost:9999/testcaseapp/testcaseservice");
              httpInvokerProxyFactoryBean.afterPropertiesSet();
              return httpInvokerProxyFactoryBean;
          }
      }
  
      @Autowired
      private TestCaseService[] testCaseServices;
      private static Server server;
  
      @BeforeClass
      public static void setUp() {
          try {
              server = new Server();
              SelectChannelConnector connector = new SelectChannelConnector();
              connector.setPort(9999);
              server.addConnector(connector);
              //
              WebAppContext webAppContext = new WebAppContext();
              webAppContext.setContextPath("/testcaseapp");
              webAppContext.setWar("src/test/java/" + RemotingTest.class.getPackage().getName().replace('.', '/'));
              server.setHandler(webAppContext);
              //
              server.start();
          } catch (Exception ex) {
              logger.info("Could not permorm the set up: {}", ex.toString());
          }
      }
  
      @AfterClass
      public static void destroy() {
          try {
              server.stop();
          } catch (Exception e) {
          }
      }
  
      @Test
      public void addTest() {
          for (TestCaseService testCaseService : testCaseServices) {
              Integer sum = testCaseService.add(10, 5);
              Assert.assertNotNull(sum);
              Assert.assertEquals(15, sum.intValue());
          }
      }
  
  }
  </code></pre>
  
  <p>I've also tried to create a TestCaseService bean</p>
  
  <pre><code>@Bean public TestCaseService testCaseService() ...
  </code></pre>
  
  <p>and provide it as a httpInvokerServiceExporter argument</p>
  
  <pre><code>@Bean public HttpInvokerServiceExporter httpInvokerServiceExporter(TestCaseService testCaseService)
  ...
  httpInvokerServiceExporter.setService(testCaseService);
  </code></pre>
  
  <p>but the result is still the same.</p>
  
  <p>What am I doing wrong? Thanks!</p>