org.apache.camel.component.direct.DirectConsumerNotAvailableException:端点上没有可用的消费者:

时间:2017-02-07 10:19:14

标签: java spring-boot apache-camel resttemplate

我是Spring引导框架的新手,最近我创建了一个spring boot web应用程序,如果我在本地运行应用程序,它工作正常并给我所需的输出但是当我尝试构建时,testcases失败了错误:

  

1)org.apache.camel.component.direct.DirectConsumerNotAvailableException:端点上没有可用的消费者:

     

2)org.springframework.web.client.HttpServerErrorException:500

这是我的代码:

@RunWith(SpringRunner.class)
@ContextConfiguration(classes = BootCamelApplication.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class BootCamelApplicationTest {
    @Test
    public void test(){
        final String requestBody = "payload";
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        HttpEntity<String> entity = new HttpEntity<String>(requestBody, headers);
        ResponseEntity<String> result = null;
        try{
            result = restTemplate.exchange(uri, HttpMethod.POST, entity, String.class);
        }
        catch(Exception e){
            e.printStackTrace();
        }
        System.out.println(result);
        assertNotNull(result);
    }
}
请告诉我哪里出错了。

0 个答案:

没有答案