有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Spring和Camel CXF在战争中表现出色

我有一个web应用程序。它有servlet和JSP等。现在我添加了一个web服务

我可以让CXF工作。我的@WebService运行良好

但是我需要web服务来访问我的bean,这些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” 我已经用谷歌搜索过了

我有

<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>

和/或 组织。阿帕奇。cxf cxf rt传输http jetty 2.7.13

但是没有

有人知道如何将EJB注入Web服务吗

如果我在@WebService上加上@Stateless,它就找不到注入的EJB。NPE。我正在使用JBossEAP6.3


共 (1) 个答案

  1. # 1 楼答案

    我以camel示例cxf tomcat为基础解决了这个问题