3 Replies Latest reply on Apr 17, 2013 8:51 AM by Meissa Sakho

    Can't define cxf interceptors

    Meissa Sakho Newbie

      Hi all,

      I'm having trouble while trying to define cxf interceptors.

      I've created a very simle Interceptor which extends the AbstractSoapInterceptor just like below:

       

       

      public class MyPhaseInterceptor extends AbstractSoapInterceptor
      {
      
          public MyPhaseInterceptor()
          {
              super(Phase.INVOKE);
              // TODO Auto-generated constructor stub
          }
      
          @Override
          public void handleMessage(SoapMessage arg0) throws Fault
          {
              // TODO Auto-generated method stub
              
          }
      

       

      I've defined the interceptors in my endpoint inside the jboss-cxf.xml file just like below:

       

      <jaxws:endpoint xmlns:tns="http://societedecaution.fr/wsdl/service/jv/casden/caution/v1"
              id="cadenCautionSA" serviceName="tns:CasdenCautionSAService"
              endpointName="tns:ICasdenCautionSARemotePort"
              address="http://localhost:8080/jv/CasdenCautionSAService"
              implementor="fr.societedecaution.wsdl.service.jv.casden.caution.v1.impl.CasdenCautionSARemoteImpl"
              publish="true" wsdlLocation="/WEB-INF/wsdl/casdencautionsingle.wsdl">
            
              <jaxws:invoker>
                  <bean class="org.jboss.wsf.stack.cxf.JBossWSInvoker" />
              </jaxws:invoker>
              <jaxws:features>
                  <bean class="org.apache.cxf.feature.LoggingFeature" />
              </jaxws:features>
              <jaxws:inInterceptors>
                  
                  <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
                  <bean class="fr.casden.interceptors.MyPhaseInterceptor" />
                  
              </jaxws:inInterceptors>
          </jaxws:endpoint>
      

      but when I deploy my application, I'm getting errors below:

       

      Caused by: java.lang.ClassNotFoundException: org.apache.cxf.phase.AbstractPhaseInterceptor from [Module "deployment.jv.war:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

         

          java.lang.NoClassDefFoundError: org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor

          at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_11]

          at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_11]

          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_11]

          at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

       

      As if the cxf module does not contains the AbstractSoapInterceptor class.

       

      does someone has any idea of what's going wrong in my configuration?

      Thanks in advance.

      Massai

        • 1. Re: Can't define cxf interceptors
          Meissa Sakho Newbie

          I've finally managed to make it work.

          • 2. Re: Can't define cxf interceptors
            Newbie

            How did you managed that? Could you elaborate this please...

            I've have same problem right now with Jboss EAP.

             

            UPD

             

            I checket thaat modules are not added implicite.

            So i changed mopdule dependencie to:


              <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                <deployment>

                    <module-alias name="xyz"/>

                    <dependencies>

                           ....

                        <module name="org.apache.cxf" export="true"/>

             

                    </dependencies>

                    <resources>

                        <resource-root path="/META-INF"/>

                    </resources>

                </deployment>

                <sub-deployment name="xyz-web-1.0.war">

                    <dependencies>

                      ...

                        <module name="org.apache.cxf" />

                    </dependencies>

             

            but now still getting:

             

            Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.interceptor.Fault: Could not create annotation object: a.b.c.TestInterceptor

                      at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:353)

                      at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:88)

                      at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:242)

                      at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:517)

                      at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:118)

                      at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:113)

                      at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:66)

                      at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)

                      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.1.3.Final-redhat-4-JBPAPP-10565.jar:7.1.3.Final-redhat-4]

                      ... 5 more

            Caused by: org.apache.cxf.interceptor.Fault: Could not create annotation object: a.b.c.TestInterceptor

                      at org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationObject(AnnotationInterceptors.java:104)

                      at org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationObjects(AnnotationInterceptors.java:58)

                      at org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(AnnotationInterceptors.java:48)

                      at org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationInterceptorList(AnnotationInterceptors.java:123)

                      at org.apache.cxf.interceptor.AnnotationInterceptors.getInInterceptors(AnnotationInterceptors.java:139)

                      at org.apache.cxf.endpoint.AbstractEndpointFactory.initializeAnnotationInterceptors(AbstractEndpointFactory.java:248)

                      at org.apache.cxf.jaxws.JaxWsServerFactoryBean.initializeAnnotationInterceptors(JaxWsServerFactoryBean.java:118)

                      at org.apache.cxf.endpoint.AbstractEndpointFactory.initializeAnnotationInterceptors(AbstractEndpointFactory.java:229)

                      at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182)

                      at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:207)

                      at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:436)

                      at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:325)

                      ... 13 more

            Caused by: java.lang.InstantiationException: a.b.c.TestInterceptor

                      at java.lang.Class.newInstance0(Class.java:359) [rt.jar:1.7.0_17]

             

            Any ideas?

            • 3. Re: Can't define cxf interceptors
              Meissa Sakho Newbie

              Hi AIexander

              've just added the missing module in my MANIFEST File.

              Here is an extract:

               

              Manifest-Version: 1.0

              Dependencies: org.springframework.spring,org.apache.cxf,org.dozer,org.apache.commons.lang

               

              In short, it is necessay to add the cxf module if you write custom cxf interceptors.

              Make sure you're declaring it in the right module.

              Meissa