I have built an Ws Client to wrap around some web services I have, using cxf
2.5.2. I am generating the code using the wsdl2java plug in and had been
relatively pleased with how its all working. Using the client code I have
written running junit tests it all seems to work fine.

My pom...

<?xml version="1.0" encoding="UTF-8"?>
<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";>

    <modelVersion>4.0.0</modelVersion>
    <groupId>myGroup</groupId>
    <artifactId>ws-client</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <name>ws-client</name>
    <url>http://maven.apache.org</url>

    <properties>
        <cxf.version>2.5.2</cxf.version>
        <java.version>1.6</java.version>
    </properties>


    <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>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                           
<sourceRoot>${basedir}/target/gen-src</sourceRoot>
                            <defaultOptions>
                                <extraargs>
                                    <extraarg>-verbose</extraarg>
                                    <extraarg>-autoNameResolution</extraarg>
                                </extraargs>
                            </defaultOptions>
                            <wsdlOptions>
                                <wsdlOption>
                                   
<wsdl>${basedir}/src/main/resources/wsdl/main/AdminService.wsdl</wsdl>
                                </wsdlOption>
                                <wsdlOption>
                                   
<wsdl>${basedir}/src/main/resources/wsdl/main/FileService.wsdl</wsdl>
                                </wsdlOption>
                                <wsdlOption>
                                   
<wsdl>${basedir}/src/main/resources/wsdl/main/SearchService.wsdl</wsdl>
                                </wsdlOption>

                            

                                <wsdlOption>
                                   
<wsdl>${basedir}/src/main/resources/wsdl/legacy/DocumentService.wsdl</wsdl>
                                </wsdlOption>
                                <wsdlOption>
                                   
<wsdl>${basedir}/src/main/resources/wsdl/legacy/SearchService.wsdl</wsdl>
                                    <extraargs>
                                        <extraarg>-p</extraarg>
                                       
<extraarg>com.serengetisystems.eintranet.ws.searchService</extraarg>
                                    </extraargs>
                                </wsdlOption>
v                                <wsdlOption>
                                   
<wsdl>${basedir}/src/main/resources/wsdl/legacy/MetadataService.wsdl</wsdl>
                                </wsdlOption>
                                <wsdlOption>
                                   
<wsdl>${basedir}/src/main/resources/wsdl/legacy/FolderService.wsdl</wsdl>
                                    <extraargs>
                                        <extraarg>-p</extraarg>
                                       
<extraarg>com.serengetisystems.eintranet.ws.folderService</extraarg>
                                    </extraargs>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
                        
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

  
Made a little test app and deployed that to tomcat, no problems here either.

Then the fun started, like most of my working year so fun I'm figting
getting things deployed onto weblogic 11g (10.3.5.0), the code won't run on
weblogic, weblogic as usual has it's own implementation of things deployed
which clash, this is the error produced.

java.lang.ClassCastException:
weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler cannot be cast to
org.apache.cxf.frontend.ClientProxy

Consulting the documentation, it says package as an ear and setting the
following prefered application pacakges
http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-WebLogic)

I've tried, all three things suggest in documentation...

    <prefer-application-packages>
        <package-name>javax.jws.*</package-name>
    </prefer-application-packages>

tried...

        <prefer-application-packages>
                <package-name>javax.jws.*</package-name>
                <package-name>org.apache.xerces.*</package-name> 
        <package-name>org.apache.xalan.*</package-name>
        </prefer-application-packages>
  
tried adding the xml section as well

<xml> 
        <parser-factory> 
        
<saxparser-factory>org.apache.xerces.jaxp.SAXParserFactoryImpl</saxparser-factory>
 
        
<document-builder-factory>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</document-builder-factory>
 
        
<transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
 
        </parser-factory> 
</xml>


These all produce the same error

java.lang.NoClassDefFoundError: javax/jws/WebService

Googling around for weblogic cxf it's popped up a few times that the issue
relates to the geronimo-ws-metadata_2.0_spec-1.1.2.jar. This jar isn't part
of my build, its not a dependency of cxf-rt-frontend-jaxws or
cxf-rt-transports-http.

Could really do with some help, javax.jws.WebService is part of the 1.6 JRE,
so I guess in saying prefer only javax.jws.* weblogic excludes the class
from the JRE, which seems crazy to me!

Has anybody got this working?

Thanks,
Dale

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Deploying-a-WS-Client-to-weblogic-tp5643425p5643425.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to