title: java.lang.NoSuchFieldError: REFLECTION
body: <p>I'm creating a project with CXF and use MTOM with some security (I don't know if that information is relevant).</p>
  <p>When I tried initialize my server I received that error:</p>
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'example': Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: REFLECTION
  </code></pre>
  <p>This is my <code>cxf-servlet.xml</code> file:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
         xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
         xmlns:jee=&quot;http://www.springframework.org/schema/jee&quot; xmlns:jaxws=&quot;http://cxf.apache.org/jaxws&quot;
         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
         xsi:schemaLocation=&quot;
           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&quot;&gt;
      
      &lt;jaxws:endpoint
                      id=&quot;example&quot;
                      address=&quot;/example&quot;
                      implementor=&quot;br.com.arthur.services.ExampleService&quot;&gt;
          
          &lt;!-- Uncomment only if using WS-SecurityPolicy --&gt;
          &lt;jaxws:properties&gt;
              &lt;entry key=&quot;mtom-enabled&quot; value=&quot;true&quot;/&gt;
              &lt;entry key=&quot;ws-security.callback-handler&quot; value-ref=&quot;myPasswordCallback&quot;/&gt;
          &lt;/jaxws:properties&gt;
          
          &lt;!-- Uncomment only if using standard WSS4J interceptors --&gt;
          &lt;!--jaxws:inInterceptors&gt; &lt;bean class=&quot;org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor&quot;&gt; 
              &lt;constructor-arg&gt; &lt;map&gt; &lt;entry key=&quot;action&quot; value=&quot;UsernameToken&quot;/&gt; &lt;entry 
              key=&quot;passwordType&quot; value=&quot;PasswordText&quot;/&gt; &lt;entry key=&quot;passwordCallbackRef&quot; 
              value-ref=&quot;myPasswordCallback&quot;/&gt; &lt;/map&gt; &lt;/constructor-arg&gt; &lt;/bean&gt; &lt;/jaxws:inInterceptors --&gt;
      &lt;/jaxws:endpoint&gt;
      
      &lt;bean id=&quot;myPasswordCallback&quot; class=&quot;br.com.arthur.services.ServerPasswordCallback&quot;/&gt;
  &lt;/beans&gt;
  </code></pre>
  <p>This is my <code>web.xml</code> file:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;web-app
   xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
           xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot;
           version=&quot;3.0&quot;&gt;
  
      &lt;display-name&gt;Sample web service provider&lt;/display-name&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;
                org.springframework.web.context.ContextLoaderListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              classpath:META-INF/cxf/cxf.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;WebServicePort&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.apache.cxf.transport.servlet.CXFServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;WebServicePort&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/services/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;60&lt;/session-timeout&gt;
      &lt;/session-config&gt;
  
      &lt;security-constraint&gt;
          &lt;web-resource-collection&gt;
              &lt;web-resource-name&gt;restricted web services&lt;/web-resource-name&gt;
              &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
              &lt;http-method&gt;GET&lt;/http-method&gt;
              &lt;http-method&gt;POST&lt;/http-method&gt;
          &lt;/web-resource-collection&gt;
          &lt;user-data-constraint&gt;
              &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
          &lt;/user-data-constraint&gt;
      &lt;/security-constraint&gt;
  &lt;/web-app&gt;
  </code></pre>
  <p>This is my <code>pom.xml</code> file:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;br.com.arthur&lt;/groupId&gt;
      &lt;artifactId&gt;security-mtom&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0.0&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;cxf.version&gt;3.0.1&lt;/cxf.version&gt;
          &lt;jdk.version&gt;1.7&lt;/jdk.version&gt;
          &lt;maven-compiler.version&gt;3.1&lt;/maven-compiler.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;spring.version&gt;4.1.0.RELEASE&lt;/spring.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-core&lt;/artifactId&gt;
              &lt;version&gt;2.7.12&lt;/version&gt;
          &lt;/dependency&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;${cxf.version}&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;${cxf.version}&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;${cxf.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-common-utilities&lt;/artifactId&gt;
              &lt;version&gt;2.5.11&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;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${maven-compiler.version}&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${jdk.version}&lt;/source&gt;
                      &lt;target&gt;${jdk.version}&lt;/target&gt;
                      &lt;encoding/&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
                  &lt;artifactId&gt;cxf-codegen-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${cxf.version}&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;generate-sources&lt;/id&gt;
                          &lt;phase&gt;generate-sources&lt;/phase&gt;
                          &lt;configuration&gt;
                              &lt;sourceRoot&gt;${project.basedir}/src/main/java&lt;/sourceRoot&gt;
                              &lt;wsdlOptions&gt;
                                  &lt;wsdlOption&gt;
                                      &lt;wsdl&gt;${project.basedir}/src/main/resources/wsdl/example.wsdl&lt;/wsdl&gt;
                                      &lt;wsdlLocation&gt;classpath:wsdl/example.wsdl&lt;/wsdlLocation&gt;
                                  &lt;/wsdlOption&gt;
                              &lt;/wsdlOptions&gt;
                          &lt;/configuration&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;wsdl2java&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  <p>I tried execute those two tutorials <a href="http://web-gmazza.rhcloud.com/blog/entry/cxf-usernametoken-profile" rel="nofollow noreferrer">http://web-gmazza.rhcloud.com/blog/entry/cxf-usernametoken-profile</a> and <a href="http://thenonsensetechlogs.wordpress.com/2011/05/09/mtom-using-apache-cxf-and-maven/" rel="nofollow noreferrer">http://thenonsensetechlogs.wordpress.com/2011/05/09/mtom-using-apache-cxf-and-maven/</a></p>