在EAP上部署Fuse Camel项目

时间:2018-10-05 10:20:05

标签: jboss apache-camel jbossfuse fuseesb

我用一个SOAP Web服务构建了一个简单的Camel项目,该项目编写了一个文件并发送响应:它打包成束,并成功部署在Karaf上,您可以在这里找到源代码

Firefox Send

然后,我想在WAR模块中转换该项目并将其部署在EAP上的Fuse上:按照以下说明进行操作

Apache Camel: Tutorial on using Camel in a Web Application

我修改了(在pom.xml中)捆绑包-> war,将applicationContext.xml移到src / main / webapp下,并用Spring上下文加载器创建了一个web.xml:安装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)

但是我认为这只是一个警告。

有人有什么主意吗?

预先感谢

1 个答案:

答案 0 :(得分:0)

“必须具有偶数个URI”例外是因为在camel-cxf-spring.xsd的末尾有xsi:schemaLocation的多余条目。

您可能会发现将代码基于Camel Tomcat CXF example更好,因为它演示了如何在web.xml中设置CXFServlet。您需要这样做是因为您希望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>

如果您在EAP 7.0或7.1上使用Fuse,则可以避免使用Spring ContextLoaderListenerCXFServlet,因为应用服务器将为您引导Spring&CXF。有一个示例项目here