Не удается автоматически создать компонент: restlet

#apache-camel #esb #jbossfuse #fuse #fuseesb

Вопрос:

Я новичок в мире предохранителей, и есть некоторые проблемы, которые я не могу решить, я надеюсь, что кто-нибудь сможет мне помочь .

Я разработал проект предохранителя с помощью IDE Redhate CodeRedy как ( Автономный предохранитель на EAP и spring Bean — spring DSL), и это мой xml-контекст верблюда

1 — jboss-camel-context.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">
    <bean
        class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer" id="bridgePropertyPlaceholder">
        <property name="location" value="classpath:/properties/properties.properties"/>
    </bean>
    <camelContext id="spring-context" xmlns="http://camel.apache.org/schema/spring">
        <route id="_route1">
            <from id="_from1" uri="restlet:http://{{http.host}}:{{http.port}}/test"/>
            <log id="_log1" message="Hello"/>
        </route>
    </camelContext>
</beans>
 

2 — pom.xml

     <?xml version="1.0" encoding="UTF-8"?
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany</groupId>
  <artifactId>camel-test-spring</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <name>Fuse on EAP Camel Spring Application</name>
  <description>Fuse on EAP Camel Example using Spring</description>
  <properties>
    <version.jboss.arquillian>1.1.10.Final</version.jboss.arquillian>
    <maven.compiler.source>1.8</maven.compiler.source>
    <version.wildfly.arquillian>2.1.0.Final</version.wildfly.arquillian>
    <server.config>standalone-camel.xml</server.config>
    <version.maven.war.plugin>3.0.0</version.maven.war.plugin>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <version.wildfly.maven.plugin>1.2.0.Final</version.wildfly.maven.plugin>
    <maven.compiler.target>1.8</maven.compiler.target>
    <version.wildfly>7.1.0.GA-redhat-11</version.wildfly>
    <version.maven.surefire.plugin>2.20.1</version.maven.surefire.plugin>
    <jboss.home>${env.JBOSS_HOME}</jboss.home>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.maven.compiler.plugin>3.8.0</version.maven.compiler.plugin>
    <fuse.version>7.8.0.fuse-sb2-780038-redhat-00001</fuse.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>fuse-eap-bom</artifactId>
        <version>7.8.0.fuse-sb2-780038-redhat-00001</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>2.23.2.fuse-780036-redhat-00001</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.servlet</groupId>
      <artifactId>jboss-servlet-api_3.1_spec</artifactId>
      <version>1.0.0.Final-redhat-1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-restlet</artifactId>
      <version>2.23.2.fuse-780036-redhat-00001</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <repositories>
  <repository>
    <id>maven.restlet.org</id>
    <name>maven.restlet.org</name>
    <url>http://maven.restlet.org</url>
  </repository>
    <repository>
      <id>jboss-public-repository</id>
      <url>http://repository.jboss.org/nexus/content/groups/public/</url>
    </repository>
    <repository>
      <id>red-hat-ga-repository</id>
      <url>https://maven.repository.redhat.com/ga</url>
    </repository>
  </repositories>
  <build>
    <testResources>
      <testResource>
        <filtering>true</filtering>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${version.maven.compiler.plugin}</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>${version.maven.war.plugin}</version>
      </plugin>
      <plugin>
        <groupId>org.wildfly.plugins</groupId>
        <artifactId>wildfly-maven-plugin</artifactId>
        <version>${version.wildfly.maven.plugin}</version>
        <configuration>
          <version>${version.wildfly}</version>
          <serverConfig>${server.config}</serverConfig>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${version.maven.surefire.plugin}</version>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>arq-managed</id>
      <dependencies>
      <dependency>
  <groupId>org.restlet.jse</groupId>
  <artifactId>org.restlet</artifactId>
  <version>2.2-RC4</version>
</dependency>
<dependency>
  <groupId>org.restlet.jse</groupId>
  <artifactId>org.restlet.ext.simple</artifactId>
  <version>2.2-RC4</version>
</dependency>
        <dependency>
          <groupId>org.wildfly.arquillian</groupId>
          <artifactId>wildfly-arquillian-container-managed</artifactId>
          <version>${version.wildfly.arquillian}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>arq-remote</id>
      <dependencies>
        <dependency>
          <groupId>org.wildfly.arquillian</groupId>
          <artifactId>wildfly-arquillian-container-remote</artifactId>
          <version>${version.wildfly.arquillian}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>jdk9 -build</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <dependencies>
        <dependency>
          <groupId>javax.annotation</groupId>
          <artifactId>javax.annotation-api</artifactId>
          <version>1.3.1</version>
        </dependency>
        <dependency>
          <groupId>javax.xml.ws</groupId>
          <artifactId>jaxws-api</artifactId>
          <version>2.3.0</version>
          <exclusions>
            <exclusion>
              <artifactId>jaxb-api</artifactId>
              <groupId>javax.xml.bind</groupId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>jakarta.xml.bind</groupId>
          <artifactId>jakarta.xml.bind-api</artifactId>
          <version>2.3.2.redhat-00001</version>
        </dependency>
        <dependency>
          <groupId>com.sun.activation</groupId>
          <artifactId>javax.activation</artifactId>
          <version>1.2.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
          <version>1.1.3</version>
        </dependency>
        <dependency>
          <groupId>com.sun.xml.messaging.saaj</groupId>
          <artifactId>saaj-impl</artifactId>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jta_1.1_spec</artifactId>
        </dependency>
        <dependency>
          <groupId>org.jboss.spec.javax.rmi</groupId>
          <artifactId>jboss-rmi-api_1.0_spec</artifactId>
          <version>1.0.5.Final-redhat-1</version>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>jdk12 -build</id>
      <activation>
        <jdk>[12,)</jdk>
      </activation>
      <properties>
        <version.maven.war.plugin>3.2.2</version.maven.war.plugin>
      </properties>
    </profile>
  </profiles>
</project>
 

Теперь я попытался развернуть этот интеграционный проект на сервере EAP Fuse, но возникла следующая проблема

 {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."LearningProject.war".CamelContextActivationService."LearningProject.war"" => "Cannot create camel context: LearningProject.war
Caused by: org.jboss.msc.service.StartException in anonymous service: Cannot start camel context: spring-context
Caused by: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route _route1: Route(_route1)[[From[restlet:http://{{http.host}}:{{http.por... because of Failed to resolve endpoint: restlet://http://localhost:8080/test due to: Cannot auto create component: restlet
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route _route1: Route(_route1)[[From[restlet:http://{{http.host}}:{{http.por... because of Failed to resolve endpoint: restlet://http://localhost:8080/test due to: Cannot auto create component: restlet
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: restlet://http://localhost:8080/test due to: Cannot auto create component: restlet
Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create component: restlet
Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create component: restlet
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.camel.component.restlet.RestletComponent': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.component.restlet.RestletComponent]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/net/httpserver/HttpHandler
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.component.restlet.RestletComponent]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/net/httpserver/HttpHandler
Caused by: java.lang.NoClassDefFoundError: com/sun/net/httpserver/HttpHandler
Caused by: java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler from [Module "deployment.LearningProject.war" from Service Module Loader]"}}
 

Как я могу решить эту проблему ???

Комментарии:

1. Я бы избегал restlet, так как он не поддерживается подсистемой Fuse EAP Camel. Для потребителей HTTP лучше использовать компоненты undertow или сервлетов, так как они интегрируются с собственным сервером EAPs Undertow.