2014-11-20 89 views
0

我有一个web应用程序。它有Servlets和JSP等,现在我添加一个Web服务。Spring和Camel CXF在WAR中很好玩

我可以得到CXF的工作。我的@WebService工作正常。

但我需要Web服务才能访问我在Spring中设置的bean。

如果我尝试添加以下内容,以便将请求转发到EJB(因为这样的独立应用程序工作正常):

<bean id="webServ" class="com.company.application.MyWebServiceHandler" /> 

<camelContext id="FindCode" xmlns="http://camel.apache.org/schema/spring"> 
    <route id="FindCodeRoute"> 
     <from uri="cxf:bean:myEndpoint?dataFormat=POJO" /> 
     <to uri="log:input?showAll=true&amp;level=INFO"/> 
     <to uri="bean:webServ?method=process" /> 
     <to uri="log:input?showAll=true&amp;level=INFO" /> 
    </route> 
</camelContext> 

它给了我“找不到任何从总线注册HttpDestinationFactory。” 我已经Google了谷歌了。

我有

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

,我已经试过进口

<dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-transports-http</artifactId> 
     <version>2.7.13</version> 
    </dependency> 

和/或 org.apache.cxf CXF-RT-运输-HTTP-码头 2.7 .13

但是没有。

有谁知道如何将EJB注入WebService?

如果我在@WebService上拍@ @Stateless,它找不到我注入的EJB。 NPE。我正在使用JBoss EAP 6.3。

回答

0

我用camel-example-cxf-tomcat作为基础解决了它。

+0

你应该解释什么是确切的解决方案,问题。还提供这个骆驼例子的链接。 – Sikorski 2014-11-24 09:28:30

+1

http://camel.apache.org/cxf-tomcat-example.html - 我不知道是什么修复了它。我认为问题是我有cxf:bean:handlerName而不是cxf:handlerName – djb 2014-11-24 11:26:02