启动jboss-camel-context.xml中定义的Camel应用程序时出现错误“无法解析匹配的构造函数”

时间:2018-10-08 06:19:53

标签: apache-camel restlet jbossfuse

使用以下对象来开发针对JBoss Fuse 6.3.0的简单REST API:

web.xml

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

  <display-name>My Web Application</display-name>

    <servlet>
       <servlet-name>RestletServlet</servlet-name>
       <servlet-class>org.restlet.ext.spring.SpringServerServlet</servlet-class>
       <init-param>
         <param-name>org.restlet.component</param-name>
         <param-value>RestletComponent</param-value>
       </init-param>
     </servlet>

     <servlet-mapping>
       <servlet-name>RestletServlet</servlet-name>
       <url-pattern>/rs/*</url-pattern>
     </servlet-mapping>
</web-app>

jboss-camel-context.xml

<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 http://www.springframework.org/schema/beans/spring-beans.xsd             http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd     ">


    <bean id="RestletComponent" class="org.restlet.Component" />

    <bean id="RestletComponentService"
        class="org.apache.camel.component.restlet.RestletComponent">
        <constructor-arg index="0">
            <ref bean="RestletComponent" />
        </constructor-arg>
    </bean>

    <camelContext id="spring-context" xmlns="http://camel.apache.org/schema/spring">
        <route id="RS_EmployersGet">
            <from uri="restlet:/getEmployers/{nric}" />
            <to id="queryEmployers" uri="sql:SELECT empr.ID, empr.EMPLOYER_CODE, empr.EMPLOYER_NAME FROM EMPLOYER empr WHERE empr.IDENTIFICATION_NO = ${header.nric}?dataSource=myDS"/>
            <marshal id="_marshal1">
                <json library="Jackson"/>
            </marshal>
        </route> 

    </camelContext>
</beans>

但是,一旦部署,就会发生以下错误:

Error creating bean with name 'RestletComponentService' defined in URL [vfs:/content/fuse-rest.war/META-INF/jboss-camel-context.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)

曾尝试将类类型添加到constructor-args标记中,但仍然发生相同的错误。

感谢您的帮助。

0 个答案:

没有答案