Разверните проект Fuse Camel на EAP

Я создаю простой проект Camel с веб-службой SOAP, которая записывает файл и отправляет ответ: он упакован как пакет, и я успешно развернул его на Karaf, вы можете найти источник здесь

Firefox Отправить

Затем я хотел бы преобразовать этот проект в модуль WAR и развернуть его на Fuse в EAP: следуя этим инструкциям

Apache Camel: Учебное пособие по использованию Camel в Интернете Заявление

Я изменил (в pom.xml) bundle -> war, я переместил applicationContext.xml в src / main / webapp, и я создал web.xml с помощью загрузчика контекста Spring: когда я устанавливаю WAR, я вижу (в журналах сервера) что маршрут Camel запущен, но SOAP WS не отображается

10:03:40,981 INFO  [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Apache Camel 2.15.1 (CamelContext: camelId) is starting

10:03:40,994 INFO  [org.apache.camel.management.ManagedManagementStrategy] (ServerService Thread Pool -- 75) JMX is enabled

10:03:41,120 INFO  [org.apache.camel.impl.converter.DefaultTypeConverter] (ServerService Thread Pool -- 75) Loaded 197 type converters

10:03:41,339 INFO  [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.

10:03:41,339 INFO  [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html

10:03:41,370 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (ServerService Thread Pool -- 75) Creating Service {http://www.springframework.org/schema/beans}CamelHelloWorldService from WSDL: classpath:wsdl/Hello.wsdl

10:03:41,732 INFO  [org.apache.cxf.endpoint.ServerImpl] (ServerService Thread Pool -- 75) Setting the server's publish address to be /CamelHelloWorld

10:03:41,764 INFO  [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Route: route2 started and consuming from: Endpoint[cxf://bean:helloWorldEndpointId]

10:03:41,764 INFO  [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Total 1 routes, of which 1 is started.

10:03:41,764 INFO  [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Apache Camel 2.15.1 (CamelContext: camelId) started in 0.783 seconds

10:03:41,764 INFO  [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 75) Root WebApplicationContext: initialization completed in 2131 ms

10:03:41,826 INFO  [org.jboss.as.server] (HttpManagementService-threads - 2) JBAS015859: Deployed "camel-hello-world-0.0.21-SNAPSHOT.war" (runtime-name : "camel-hello-world-0.0.21-SNAPSHOT.war")

Если честно, я тоже вижу это исключение

10:03:39,711 WARN  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 75) Ignored XML validation warning: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 419; SchemaLocation: schemaLocation value = ' 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://camel.apache.org/schema/cxf/camel-cxf-spring.xsd' must have even number of URI's.

at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)

at org.apache.xerces.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:97)

at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)

at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)

но я думаю, это всего лишь предупреждение.

Есть у кого-нибудь идеи?

заранее спасибо


person TommyR22    schedule 05.10.2018    source источник
comment
SOAP WS кажется открытым, в журналах я вижу: 10:03:41,732 INFO [org.apache.cxf.endpoint.ServerImpl] (ServerService Thread Pool -- 75) Setting the server's publish address to be /CamelHelloWorld   -  person Federico Cerruto    schedule 06.10.2018


Ответы (1)


Исключение «должно быть четное число URI» связано с тем, что у вас есть лишняя запись для camel-cxf-spring.xsd в конце xsi:schemaLocation.

Возможно, вам будет лучше основывать свой код на Camel Пример Tomcat CXF, демонстрирующий, как настроить CXFServlet в web.xml. Вам это понадобится, если вы хотите, чтобы потребитель CXF работал. Например, вот так:

<servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/webservices/*</url-pattern>
</servlet-mapping>

Если вы используете Fuse в EAP 7.0 или 7.1, вы можете избежать Spring ContextLoaderListener и CXFServlet, поскольку сервер приложений позаботится о начальной загрузке Spring и CXF за вас. здесь есть пример проекта.

person James Netherton    schedule 07.10.2018