3 Replies Latest reply on Apr 5, 2011 4:17 AM by asoldano

    JBoss 5.1.0, Apache CXF, Spring, and WSS4J issue

    anotherjbossuser

      I'm trying to get some security running (wss4jInterceptor). Everything seems to go fine through war deployment. When I try to access the web service it not only seems to ignore the security it throws this exception:

       

      java.lang.ClassNotFoundException: org.apache.ws.security.transform.STRTransform from BaseClassLoader

       

       

      I have verified that the wss4j-1.5.11.jar is in the classpath and that STRTransform is in it.

       

      Has anyone know how to get this fixed?

       

      Thanks,

       

      John

        • 1. JBoss 5.1.0, Apache CXF, Spring, and WSS4J issue
          asoldano

          Please consider sharing more info regarding your deployment and where the exception is thrown.

          Did you properly install jbossws-cxf?

          • 2. Re: JBoss 5.1.0, Apache CXF, Spring, and WSS4J issue
            anotherjbossuser

            Thanks Alessio for the response. Forgive me I'm relatively new to this.

             

            I haven't done anything with the JBoss 5.1.0 GA server that is downloaded other than adding the ojdbc.jar to access an Oracle datasource.

             

            Deploying works fine and other than the addition of the wss4j security the web service works fine. Here's the beginning of the stack trace happening when I call any web service interface method:

             

            2011-04-01 11:09:00,126 ERROR [STDERR] (http-127.0.0.1-8080-2) java.lang.ClassNotFoundException: org.apache.ws.security.transform.STRTransform

            from BaseClassLoader@110769b{VFSClassLoaderPolicy@1daf835{name=vfsfile:/C:/Documents%20and%20Settings/jj/Desktop/GA/jboss-5.1.0.GA/server/default

            /deployers/jbossws.deployer/ domain=ClassLoaderDomain@19c7c21{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@1de3f2d}

            roots=[MemoryContextHandler@14513156[path= context=vfsmemory://ap403g-tsevsv-glz909pu-1-glz910q2-e real=vfsmemory://ap403g-tsevsv-glz909pu-1-glz910q2-e],

             

            Even though this exception is thrown, the web service still works.

             

            For the WSS4J stuff I added:

             

            <cxf.version>2.2.12</cxf.version>

             

             

            <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-ws-security</artifactId>

             

            As far as I know I haven't done anything with jbossws-cxf as all the CXF stuff I'm working with is directly Apache. I assume the jbossws-cxf stack is JBoss specific? If so I would prefer to stay away from a vendor specific implemetation of anything as I don't want to tie it to JBoss in the future.

             

            I'm also using the Spring framework if that is of any use.


            When I deploy the war, I also make sure the war file uses the library files I include in the war file and not the ones in JBoss via the addition of a jboss-web.xml file telling it to do so:

             

            <jboss-web>

            <class-loading java2ClassLoadingCompliance="true">

            <loader-repository>

             

             

            com.comp.wu:loader=MyService.war

            </loader-repository>

            </class-loading>

            </jboss-web>

             

            I'm also using the Spring framework if that is of any use.

             

            Here's the the other CXF files I am using:

             

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-java2ws-plugin</artifactId>

            <version>${cxf.version}</version>

            <dependencies>

            <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-frontend-jaxws</artifactId>

            <version>${cxf.version}</version>

            </dependency>

            <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-frontend-simple</artifactId>

            <version>${cxf.version}</version>

            </dependency>

            </dependencies>

             

            <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-frontend-jaxws</artifactId>

            <version>${cxf.version}</version>

            </dependency>

             

            <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-transports-http</artifactId>

            <version>${cxf.version}</version>

            </dependency>

            <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-transports-http-jetty</artifactId>

            <version>${cxf.version}</version>

            </dependency>

            Thanks again for your help.

            John

             

            • 3. Re: JBoss 5.1.0, Apache CXF, Spring, and WSS4J issue
              asoldano

              Hi John,

              ok, so you're not using jbossws-cxf and this is a generic issue with using Apache CXF directly on top of JBoss Application Server. I might provide some hints / suggestion to help, but generally speaking one of aims of the JBossWS-CXF project is exactly solving this kind of integration problems.

               

              john h wrote:

               

              Thanks Alessio for the response. Forgive me I'm relatively new to this.

               

              I haven't done anything with the JBoss 5.1.0 GA server that is downloaded other than adding the ojdbc.jar to access an Oracle datasource.

               

              Deploying works fine and other than the addition of the wss4j security the web service works fine. Here's the beginning of the stack trace happening when I call any web service interface method:

               

              2011-04-01 11:09:00,126 ERROR [STDERR] (http-127.0.0.1-8080-2) java.lang.ClassNotFoundException: org.apache.ws.security.transform.STRTransform

              from BaseClassLoader@110769b{VFSClassLoaderPolicy@1daf835{name=vfsfile:/C:/Documents%20and%20Settings/jj/Desktop/GA/jboss-5.1.0.GA/server/default

              /deployers/jbossws.deployer/ domain=ClassLoaderDomain@19c7c21{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@1de3f2d}

              roots=[MemoryContextHandler@14513156[path= context=vfsmemory://ap403g-tsevsv-glz909pu-1-glz910q2-e real=vfsmemory://ap403g-tsevsv-glz909pu-1-glz910q2-e],

              What's the full stacktrace?

              And where did you add the wss4j lib? It seems there's some kind of clash, given the classloader for the jbossws.deployer is trying to access that apache class. Or the classloading setup you mention below is preventing jbossws from accessing wss4j classes (and why does it need them?).

               

               


              As far as I know I haven't done anything with jbossws-cxf as all the CXF stuff I'm working with is directly Apache. I assume the jbossws-cxf stack is JBoss specific? If so I would prefer to stay away from a vendor specific implemetation of anything as I don't want to tie it to JBoss in the future.

               

              Besides jokes (how is that JBossWS is vendor specific and Apache CXF and Spring later are not? ;-) ), JBossWS-CXF provides a integration layer for CXF on top of JBoss AS. So you can use plain jaxws api and stay really on a 100% portable application, or you can use the apache cxf api (annotations, interceptors, ...) with it. Take a look at the documentation for more info.

               

               


              When I deploy the war, I also make sure the war file uses the library files I include in the war file and not the ones in JBoss via the addition of a jboss-web.xml file telling it to do so:

               

              <jboss-web>

              <class-loading java2ClassLoadingCompliance="true">

              <loader-repository>

               

               

              com.comp.wu:loader=MyService.war

               

              </loader-repository>

              </class-loading>

              </jboss-web>

               

               

              OK, in any case it's not clear if you're deploying a ws endpoint or you have a servlet app acting as a ws client.

              The full stacktrace above might reveal more on when the exception is thrown and what throws it.