Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CXF 2.4.2: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http

Tags:

java

soap

cxf

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.

like image 622
Dan Barber Avatar asked Sep 30 '11 14:09

Dan Barber


3 Answers

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

like image 164
Hans Beemsterboer Avatar answered Nov 20 '22 06:11

Hans Beemsterboer


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.

like image 19
Dmitry Spikhalskiy Avatar answered Nov 20 '22 05:11

Dmitry Spikhalskiy


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>
like image 5
Dilip Muthukurussimana Avatar answered Nov 20 '22 05:11

Dilip Muthukurussimana