22

I have a service client generated from wsdl. I am trying to call the remote service and I recieve the conduit initiator error seen below. I have tried numerous solutions without success.

I found solutions (old posts) that recommend using the http-jetty extensions. I do not believe this makes sense for me because the server is not running locally.

I've also found that closest configuration that helps me is an example cxf.xml file that contains:

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

This configuration provides guidance on how to configure a transport factory and bind it to http://schemas.xmlsoap.org/soap/http . When I try this with the HTTPTransportFactory, I receive an exception that it cannot be initialized (no such method error).

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)

precaution: At this point, I will stop my attempt to upgrade my CXF client to 2.4.2 and fall back to the oldest version that works (2.2 series). This is not ideal.

I would like to move forward with the upgrade. Any suggestions regarding how to configure CXF 2.4.X so that my client-only HTTP SOAP configuration wires correctly would be much appriciated.

Polostor
  • 187
  • 6
  • 25
Dan Barber
  • 549
  • 2
  • 7
  • 11

8 Answers8

26

Like recommended by the old posts, this is solved by adding cxf-rt-transports-http-jetty into the mix.

  • Excellent. Running a JUnit test directly from within eclipse had no problems, but needed to add this dependency (with test scope) in order to run unit test from the command line: mvn test – majorbanzai Apr 10 '13 at 15:59
  • 4
    Adding cxf-rt-transports-http has much fewer dependencies and works just as well. – AlexV Aug 26 '14 at 23:45
  • 2
    cxf-rt-transports-http has already been added, yet still the same error. Running this in tomcat – Daniel Bo Dec 09 '14 at 15:12
  • 7
    Does anybody know what is the reason that this dependency is required? I have the case that on Intellij IDE everything works fine but maven surefire does not work. Does the Intellij JUnit runner has this dependency ? – Przemek Nowak Mar 05 '15 at 14:28
20

This error can be produced by invalid url format on client. For example, if you use http transport, you should define "http://localhost:8080/services/{smth}" url. And if you define "localhost:8080/services/{smth}" without http prefix - you receive such an error.

Dmitry Spikhalskiy
  • 5,379
  • 1
  • 26
  • 40
5

I was also facing the same issue. Through IntelliJ everything was working fine but maven surefire was throwing up error. And finally found the answer. Here it is:

Basically the cxf libraries each supply a META-INF/cxf/bus-extensions.txt file and the default behavior of the packager is to replace that file, causing it to be incomplete. By configuring the shader to append instead of replace the cxf stuff will behave correctly.

Add this to your build section of your pom in the plugins section:

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

Did you put the cxf-rt-binding-soap-2.4.x.jar into your class path?

Willem Jiang
  • 3,291
  • 1
  • 14
  • 14
  • Yes (thanks for responding!). In my MAVEN POM, I have: org.apache.cxf cxf-rt-bindings-soap ${cxf.version} – Dan Barber Oct 12 '11 at 18:43
  • If you have that dependency you should not have the issue :) – Willem Jiang Oct 14 '11 at 08:32
  • I had this problem with a SOAP Service that was on the same JBoss than the client. The important thing is to add this dependency to the client module. – Björn Landmesser Apr 14 '15 at 13:27
  • @WillemJiang: "If you have that dependency you should not have the issue", but even with the `cxf-rt-bindings-soap` dependency (as well as `cxf-rt-transports-http` and `cxf-rt-transports-http-jetty` and a bunch of other CXF ones) in my pom.xml, and a 100% valid URL, I still get this unclear error message locally (works fine when deployed to the server)... – Amos M. Carpenter Jan 27 '16 at 03:59
3

Recently I upgraded cxf-rt-ws-security to 3.0.0. From then I started getting org.apache.cxf.BusException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. at org.apache.cxf.bus.managers.ConduitInitiatorManagerImpl.getConduitInitiator(ConduitInitiatorManagerImpl.java:110).

This issue was resolved after i upgraded the below jars to 3.0.0 in my pom.xml cxf-rt-frontend-jaxws cxf-rt-ws-policy cxf-rt-transports-http

Sudarshan
  • 31
  • 1
1

This doesn't apply specifically to the original poster's example URLs listed, but we got this error when the URL was incorrect. I.e., we had a certain string in the URL path listed twice instead of once.

icfantv
  • 4,523
  • 7
  • 36
  • 53
1

I had a similar situation with this error and for this issue seems to be coming with the older versions of the following jars

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

When I have switched to the latest releases of these jars (3.2.1, at the time of writing) has resolved the error.

N00b Pr0grammer
  • 4,503
  • 5
  • 32
  • 46
0

Removing this Dependency from my POM Fixed the error for me

   <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>3.1.1</version>
    </dependency>
Abhishek Galoda
  • 2,753
  • 24
  • 38
  • This means that you have switched from CXF to the default JDK implementation of JAX-WS. See http://stackoverflow.com/questions/11566609/difference-between-jax-ws-axis2-and-cxf for the differences. – Pino Apr 19 '17 at 14:57