2

私は残りのサービスを開発し、Apache Camel の CXFRS を介して同じものを公開しようとしました。http://camel.apache.org/cxfrs.htmlに記載されているすべての手順に従い、指定された多くのサンプルも参照しました。私はすでに質問Can't find the request for url Observerを参照しましたが、私の場合は単純な残りのリクエストです。以下は、使用される Service クラス、Route クラス、および cxf コンテキストです。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"  xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"

   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring
   http://camel.apache.org/schema/spring/camel-spring.xsd
   http://camel.apache.org/schema/cxf
   http://camel.apache.org/schema/cxf/camel-cxf.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context.xsd
   http://cxf.apache.org/jaxrs
   http://cxf.apache.org/schemas/jaxrs.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<context:annotation-config />

<!-- enable Spring @Component scan -->
<context:component-scan base-package="org.camelsample.rest" />

<cxf:rsServer id="rsServer" address="/rest"
    serviceClass="org.camelsample.rest.service.SampleRestService"
    loggingFeatureEnabled="true" loggingSizeLimit="20">
    <cxf:providers>
        <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
    </cxf:providers>
</cxf:rsServer>

<camel:camelContext id="samplerestservice"
    xmlns="http://camel.apache.org/schema/spring">
    <contextScan />
    <jmxAgent id="agent" createConnector="true" />
</camel:camelContext>

</beans>

サービス クラス:

package org.camelsample.rest.service;

import javax.ws.rs.GET;
import javax.ws.rs.Path;

public class SampleRestService {

    @GET
    @Path("/")
    public String sampleService() {
      return null;
    }
}

ルート クラス:

package org.camelsample.rest.route;

import org.apache.camel.spring.SpringRouteBuilder;

public class SampleRestRoute extends SpringRouteBuilder {

    @Override
    public void configure() throws Exception {
        // TODO Auto-generated method stub
        from("cxfrs:bean:rsServer").log("Into Sample   Route").setBody(constant("Success"));
    }
}

しかし、http://localhost:8080/restを使用してヒットしてテストしようとすると、常に次のエラー メッセージが表示されます。

2015-05-29 13:38:37.920  WARN 6744 --- [nio-8080-exec-2] o.a.c.t.servlet.ServletController        : Can't find the the request for http://localhost:8080/favicon.ico's Observer 
2015-05-29 13:38:40.295  WARN 6744 --- [nio-8080-exec-3] o.a.c.t.servlet.ServletController        : Can't find the the request for http://localhost:8080/rest's Observer 

Spring Boot を使用して残りのサンプルをテストしています。

4

1 に答える 1