CXF 2.4.2:没有为命名空间http://schemas.xmlsoap.org/soap/http找到管道启动器



我有一个从wsdl生成的服务客户端。我正在尝试调用远程服务,并收到如下所示的管道启动器错误。我尝试了许多方法,但都没有成功。

我找到了建议使用http-jetty扩展的解决方案(旧帖子)。我不认为这对我有意义,因为服务器不是在本地运行的。

我还发现,最接近的配置,帮助我是一个例子cxf.xml文件,其中包含:

<bean class="org.apache.cxf.transport.local.LocalTransportFactory"
    lazy-init="false">
    <property name="transportIds">
        <list>
            <value>http://cxf.apache.org/transports/local</value>
            <value>http://cxf.apache.org/transports/http</value>
            <value>http://schemas.xmlsoap.org/soap/http</value>
            <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
        </list>
    </property>
</bean>

此配置提供了如何配置传输工厂并将其绑定到http://schemas.xmlsoap.org/soap/http的指导。当我尝试使用HTTPTransportFactory时,我收到一个异常,它无法初始化(没有这样的方法错误)。

Caused by: org.apache.cxf.BusException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http.
    at org.apache.cxf.transport.ConduitInitiatorManagerImpl.getConduitInitiator(ConduitInitiatorManagerImpl.java:112)
    at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:73)
    at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:61)
    at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:708)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:476)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:127)
在这一点上,我将停止尝试将CXF客户机升级到2.4.2,并退回到可以工作的最旧版本(2.2系列)。这并不理想。

我想继续升级。关于如何配置CXF 2.4的任何建议。

就像以前的帖子推荐的那样,这个问题可以通过添加cxf-rt-transports-http-jetty来解决。

此错误可能是由于客户端url格式无效而产生的。例如,如果使用http传输,则应该定义"http://localhost:8080/services/{smth}"url。如果你定义的"localhost:8080/services/{smth}"没有http前缀-你会收到这样的错误。

我也面临着同样的问题。通过IntelliJ,一切工作正常,但maven肯定会抛出错误。终于找到了答案。

基本上,每个cxf库都提供一个META-INF/cxf/bus-extensions.txt文件,打包器的默认行为是替换该文件,导致它不完整。通过将着色器配置为追加而不是替换cxf内容将会正确运行。

将此添加到插件部分的构建部分:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>1.4</version>
    <configuration>
      <createDependencyReducedPom>true</createDependencyReducedPom>
    </configuration>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
              <resource>META-INF/cxf/bus-extensions.txt</resource>
            </transformer>
          </transformers>
          <filters>
            <filter>
              <artifact>*:*</artifact>
              <excludes>
                <exclude>META-INF/*.SF</exclude>
                <exclude>META-INF/*.DSA</exclude>
                <exclude>META-INF/*.RSA</exclude>
              </excludes>
            </filter>
          </filters>
        </configuration>
      </execution>
    </executions>
  </plugin>

是否将cxf- art -binding-soap-2.4.x.jar放入类路径中?

最近我将cxf-rt-ws-security升级到3.0.0。从那时起,我开始得到org.apache.cxf.BusException:没有为命名空间http://schemas.xmlsoap.org/soap/http找到管道启动器。org.apache.cxf.bus.managers.ConduitInitiatorManagerImpl.getConduitInitiator (ConduitInitiatorManagerImpl.java: 110) .

在我的pom.xml中将下面的jar升级到3.0.0之后,这个问题得到了解决cxf-rt-frontend-jaxwscxf-rt-ws-policycxf-rt-transports-http

这并不特别适用于原始海报的示例URL列表,但当URL不正确时,我们得到了这个错误。也就是说,我们有一个特定的字符串在URL路径中列出两次而不是一次。

我遇到过类似的错误情况,这个问题似乎与以下jar的旧版本有关

cxf-core-2.x.jar
cxf-rt-frontend-jaxrs-2.x.jar
cxf-rt-rs-client-2.x.jar
cxf-rt-transports-http-2.x.jar

当我切换到这些jar的最新版本(3.2.1,在撰写本文时)已经解决了这个错误。

从我的POM中移除此依赖修复了我的错误

   <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>3.1.1</version>
    </dependency>

最新更新