title: cxf + wss4j + maven NoSuchMethod error
body: <p>trying to use the cxf+wss4j using maven. Created both the service and client without any compilation issues. The service runs fine in tomcat.
  <br/><b>Issue:</b>
  When I run the client code, I get <b>"java.lang.NoSuchMethodError: org.apache.xml.security.utils.I18n.init(Ljava/util/ResourceBundle;)V".</b> This class is in xmlsec jar which comes along with cxf distribution. </p>
  
  <p><b>pom.xml for service project:</b></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;userNameTokenService&lt;/groupId&gt;
      &lt;artifactId&gt;userNameTokenService&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-ws-security&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.ws.security&lt;/groupId&gt;
              &lt;artifactId&gt;wss4j&lt;/artifactId&gt;
              &lt;version&gt;1.6.15&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;3.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;3.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;3.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
              &lt;version&gt;3.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-expression&lt;/artifactId&gt;
              &lt;version&gt;3.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                      &lt;configuration&gt;
                          &lt;webXml&gt;WebContent\WEB-INF\web.xml&lt;/webXml&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><br/><b>pom.xml for client project</b></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;userNameTokenClient&lt;/groupId&gt;
    &lt;artifactId&gt;userNameTokenClient&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-ws-security&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.ws.security&lt;/groupId&gt;
              &lt;artifactId&gt;wss4j&lt;/artifactId&gt;
              &lt;version&gt;1.6.15&lt;/version&gt;
          &lt;/dependency&gt;
        &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;3.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;3.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;build&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;resources&gt;
        &lt;resource&gt;
          &lt;directory&gt;src&lt;/directory&gt;
          &lt;excludes&gt;
            &lt;exclude&gt;**/*.java&lt;/exclude&gt;
          &lt;/excludes&gt;
        &lt;/resource&gt;
      &lt;/resources&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.0&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.6&lt;/source&gt;
            &lt;target&gt;1.6&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Edit:
  Using wss4j to try out user name token, client code:</p>
  
  <pre><code>public static void main(String[] args) {
          ApplicationContext context = new ClassPathXmlApplicationContext("spring-context.xml");
          HelloWorld helloworld= (HelloWorld) context.getBean("helloClient");
          HelloRequest hreq = new HelloRequest();
          hreq.setRequestMsg("This is client");
          HelloResponse hres = helloworld.sayHello(hreq);
          System.out.println(hres.getResponseMsg());
      }
  </code></pre>
  
  <p><b>client wss4j config:</b></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
   http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"&gt;
  
      &lt;bean id="logInBound" class="org.apache.cxf.interceptor.LoggingInInterceptor" /&gt;
      &lt;bean id="logOutBound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" /&gt;
      &lt;jaxws:client id="helloClient" serviceClass="com.ddmwsst.helloworld.HelloWorld"
          address="http://localhost:8080/userNameTokenService/services/HelloWorld"&gt;
          &lt;jaxws:inInterceptors&gt;
              &lt;ref bean="logInBound" /&gt;
          &lt;/jaxws:inInterceptors&gt;
          &lt;jaxws:outInterceptors&gt;
              &lt;ref bean="logOutBound" /&gt;
              &lt;ref bean="outbound-security" /&gt;
          &lt;/jaxws:outInterceptors&gt;
      &lt;/jaxws:client&gt;
  
      &lt;!-- WSS4JOutInterceptor for incorporating a UsernameToken in a SOAP --&gt;
      &lt;bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"
          id="outbound-security"&gt;
          &lt;constructor-arg&gt;
              &lt;map&gt;
                  &lt;entry key="action" value="UsernameToken" /&gt;
                  &lt;entry key="user" value="dummy" /&gt;
                  &lt;!--entry key="passwordType" value="PasswordText"/ --&gt;
                  &lt;entry key="passwordCallbackClass" value="client.ClientPasswordCallback" /&gt;
              &lt;/map&gt;
          &lt;/constructor-arg&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><b>service wss4j config:</B></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
      xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
   http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"&gt;
  
      &lt;import resource="classpath:META-INF/cxf/cxf.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-servlet.xml" /&gt;
  
      &lt;bean id="logInBound" class="org.apache.cxf.interceptor.LoggingInInterceptor" /&gt;
      &lt;bean id="logOutBound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" /&gt;
      &lt;!-- WSS4JInInterceptor for processing a UsernameToken from the SOAP --&gt;
      &lt;bean id="inbound-security" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"&gt;
          &lt;constructor-arg&gt;
              &lt;map&gt;
                  &lt;entry key="action" value="UsernameToken" /&gt;
                  &lt;!--entry key="passwordType" value="PasswordText"/ --&gt;
                  &lt;entry key="passwordCallbackClass" value="server.ServerPasswordCallback" /&gt;
              &lt;/map&gt;
          &lt;/constructor-arg&gt;
      &lt;/bean&gt;
  
      &lt;jaxws:endpoint id="helloWorld" implementor="server.HelloWorldImpl"
          address="/HelloWorld"&gt;
          &lt;jaxws:inInterceptors&gt;
              &lt;ref bean="logInBound" /&gt;
              &lt;ref bean="inbound-security" /&gt;
          &lt;/jaxws:inInterceptors&gt;
          &lt;jaxws:outInterceptors&gt;
              &lt;ref bean="logOutBound" /&gt;
          &lt;/jaxws:outInterceptors&gt;
      &lt;/jaxws:endpoint&gt;
  &lt;/beans&gt;
  </code></pre>