Получение ошибки «Не удалось разрешить соответствующий конструктор» при запуске приложения Camel, определенного в jboss-camel-context.xml - PullRequest
0 голосов
/ 08 октября 2018

Работа над простым REST API с целевым значением JBoss Fuse 6.3.0 со следующими параметрами:

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, но все равно произошла ошибка.

Любая помощь приветствуется.

...