Я пытаюсь использовать компонент причала с apache верблюдом и просто напечатать сообщение "Hello World". Но я сталкиваюсь с ошибкой, которая говорит -> Не удалось разрешить конечную точку: jetty: // http://localhost: 8888 / sample из-за: Не найден компонент со схемой: jetty , Even хотя я добавил зависимость для молы в моем пом. xml. Пожалуйста, скажите мне, что я делаю не так. Ниже мой код и файл pom
package com.rama.example;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class JettyGreeting {
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
// TODO Auto-generated method stub
from("jetty:http://localhost:8888/sample")
.log("Received a request")
.setBody(simple("Hello, World"));
}
});
while(true)
context.start();
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-
4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>camel-rest-expose</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>3.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-jetty -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jetty</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Ошибка:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[From[jetty:http://localhost:8888/sample] -> [L... because of Failed to resolve endpoint: jetty://http://localhost:8888/sample due to: No component found with scheme: jetty
at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:118)
at org.apache.camel.impl.DefaultModel.start(DefaultModel.java:356)
at org.apache.camel.impl.DefaultModel.startRoute(DefaultModel.java:330)
at org.apache.camel.impl.DefaultModel.startRouteDefinitions(DefaultModel.java:323)
at org.apache.camel.impl.DefaultModel.startRouteDefinitions(DefaultModel.java:302)
at org.apache.camel.impl.AbstractModelCamelContext.startRouteDefinitions(AbstractModelCamelContext.java:326)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2679)
at org.apache.camel.impl.engine.AbstractCamelContext.lambda$doStart$2(AbstractCamelContext.java:2527)
at org.apache.camel.impl.engine.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:2544)
at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2525)
at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:121)
at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2421)
at com.rama.example.JettyGreeting.main(JettyGreeting.java:26)
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: jetty://http://localhost:8888/sample due to: No component found with scheme: jetty
at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:834)
at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:57)
at org.apache.camel.impl.engine.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:123)
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:367)
at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:112)
... 12 more