Apache Camel Restlet не удалось разрешить конечную точку из-за: null: NullPointerException - PullRequest
0 голосов
/ 06 августа 2020

Я новичок в Apache Camel. Я запускаю промежуточное ПО Red Hat с CodeReady Studio 12.16.0.GA в автономной среде загрузки Spring в качестве локального контекста Camel. Я создал простой проект интеграции Fuse с компонентом restlet, чтобы сделать выноску для службы отдыха. Вот мой верблюжий контекст. xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="        http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd        http://camel.apache.org/schema/spring       https://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <route id="simple-route">
        <from id="route-timer" uri="timer://foo"/>
        <to id="_to1" uri="restlet:http:restcountries.eu:80/rest/v2/alpha/US"/>
        <setBody id="_setBody1">
            <simple>${body}</simple>
        </setBody>
        <log id="route-log" message=">>> ${body}"/>
    </route>
</camelContext>
</beans>

Когда я запускаю свой проект, я получаю исключение:

[ERROR] Failed to execute goal org.jboss.redhat-fuse:spring-boot-maven-plugin:7.6.0.fuse-760027-redhat-00001:run (default-cli) on project camel-ose-springboot-xml: An exception occurred while running. null: InvocationTargetException: org.apache.camel.FailedToCreateRouteException: Failed to create route simple-route at: >>> To[restlet:http:restcountries.eu:80/rest/v2/alpha/US] <<< in route: Route(simple-route)[[From[timer://foo]] -> [To[restlet:http:... because of Failed to resolve endpoint: restlet://http:restcountries.eu:80//rest/v2/alpha/US due to: null: NullPointerException

Что не так? Заранее спасибо.

Ответы [ 2 ]

1 голос
/ 06 августа 2020

URI, используемый для производителя рестлета, недействителен. Указанный вами URL-адрес не соответствует схеме правильно. Он должен выглядеть следующим образом (обратите внимание на добавление // после http:):

<to id="_to1" uri="restlet:http://restcountries.eu:80/rest/v2/alpha/US"/>
0 голосов
/ 06 августа 2020

Вам необходимо добавить зависимость верблюжьего рестлета в свой файл pom.

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-restlet</artifactId>
    <version>YOUR CAMEL VERSION</version>
</dependency>

Или, поскольку вы используете Fuse, вам может потребоваться установить функцию верблюжьего рестлета:

feature:install camel-restlet

...