You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Shelli Orton <Sh...@sjrb.ca> on 2011/04/13 20:04:52 UTC
wsdl2java - Set Java Version?
Hi,
I'm brand new to CXF and am trying to create a client from WSDL. I have
used Metro and Axis in the past. I downloaded apache-cxf-2.3.3 and used
wsdl2java to generate the client stubs. I use Maven and set it up my
pom with this:
<properties>
<cxf.version>2.3.3</cxf.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>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<optimize>true</optimize>
<debug>true</debug>
</configuration>
</plugin>
</plugins>
</build>
When I build the project, I get these errors:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
(default-compile) on project client-cxf: Compilation failure:
Compilation failure:
[ERROR]
\Devel\Projects\Client-CXF\src\main\java\my\webservice\ServiceRuntimeExc
eption.java:[38,149] cannot find symbol
[ERROR] symbol : method required()
and
[ERROR]
\Devel\Projects\Client-CXF\src\main\java\my\snmpv2\MyService.java:[76,8]
cannot find symbol
[ERROR] symbol : constructor
Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFe
ature[])
[ERROR] location: class javax.xml.ws.Service
The wsdl2java generated code producing the error is:
It appears that the problems are related to the fact that the generated
code uses Java 6 features ("require" element for XmlElementRef, new
constructors for Service) yet the CXF Maven dependencies are for Java 5.
Is there a way to specify that the generated code should be Java 5
compliant?
Thanks!
Shelli
Re: ClassCastException (SEIStub/ClientProxy)
Posted by Daniel Kulp <dk...@apache.org>.
With it finding com.sun.xml.ws.client.sei.SEIStub, that means the RI is being
picked up on the classpath prior to CXF. That isn't even the "built into the
JDK" version. The cxf-rt-frontend-jaxws thing only would work if it's before
the RI version on the classpath. You would likely need to figure out where
that is coming from and remove it if you can.
If not, the best option is to switch from using the generated XXXXService
class to using the JaxWsProxyFactoryBean to create the proxy. Doing that
would bypass the SPI lookup stuff entirely and would make sure CXF is being
used.
Dan
On Monday 18 April 2011 10:41:20 AM Shelli Orton wrote:
> Hi,
>
> Is there no one who can give me some advice on this issue?
>
> Thanks,
> Shelli
>
> -----Original Message-----
> From: Shelli Orton
> Sent: Friday, April 15, 2011 9:30 AM
> To: users@cxf.apache.org
> Subject: ClassCastException (SEIStub/ClientProxy)
>
> Hi,
>
> I'm trying to build a client jar file to access a webservice. I'm including
> the jar in a servlet/war that makes the client webservice calls. I'm
> getting the following error:
>
> INFO: 2011 Apr 14 14:57:32,780 MDT [http-thread-pool-8181(4)] ERROR
> my.package.ClientServlet - Caught exception java.lang.ClassCastException:
> com.sun.xml.ws.client.sei.SEIStub cannot be cast to
> org.apache.cxf.frontend.ClientProxy at
> org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93) at
> my.package.Client.<init>(Client.java:54)
> at my.package.ClientServlet.testService(TestServlet.java:118)
>
> I came across this post
> http://yaytay.wordpress.com/2010/03/06/lsned-29-persuading-jdk-6-to-use-cx
> f-classes-rather-than-its-own-avoiding-seistub/ which says to fix the
> problem you need to include cxf-rt-frontend-jaxws as a dependency, which I
> do. So, that isn't the problem/solution in my case.
>
> My client jar pom has these dependencies:
>
> <properties>
> <cxf.version>2.3.3</cxf.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-ws-security</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> </dependencies>
>
> The servlet war contains the following in its lib:
>
> asm-3.3.jar
> bcprov-jdk15-1.45.jar
> commons-logging-1.1.1.jar
> cxf-api-2.3.3.jar
> cxf-common-schemas-2.3.3.jar
> cxf-common-utilities-2.3.3.jar
> cxf-rt-bindings-soap-2.3.3.jar
> cxf-rt-bindings-xml-2.3.3.jar
> cxf-rt-core-2.3.3.jar
> cxf-rt-databinding-jaxb-2.3.3.jar
> cxf-rt-frontend-jaxws-2.3.3.jar
> cxf-rt-frontend-simple-2.3.3.jar
> cxf-rt-ws-addr-2.3.3.jar
> cxf-rt-ws-security-2.3.3.jar
> cxf-tools-common-2.3.3.jar
> geronimo-javamail_1.4_spec-1.7.1.jar
> jaxb-impl-2.1.13.jar
> log4j-1.2.14.jar
> neethi-2.0.4.jar
> my-client-cxf-1.0.jar
> serializer-2.7.1.jar
> slf4j-api-1.4.2.jar
> slf4j-log4j12-1.4.2.jar
> stax2-api-3.0.2.jar
> woodstox-core-asl-4.0.8.jar
> wsdl4j-1.6.2.jar
> wss4j-1.5.11.jar
> xalan-2.7.1.jar
> xml-resolver-1.2.jar
> XmlSchema-1.4.7.jar
> xmlsec-1.4.4.jar
>
> I've also read some posts that talk about a javax.xml.ws.spi.Provider file,
> but haven't been able to find any references that detail what it should be
> named, contain and placed.
>
> Can anybody point me in the right direction?
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com
RE: ClassCastException (SEIStub/ClientProxy)
Posted by Shelli Orton <Sh...@sjrb.ca>.
Hi,
Is there no one who can give me some advice on this issue?
Thanks,
Shelli
-----Original Message-----
From: Shelli Orton
Sent: Friday, April 15, 2011 9:30 AM
To: users@cxf.apache.org
Subject: ClassCastException (SEIStub/ClientProxy)
Hi,
I'm trying to build a client jar file to access a webservice. I'm including the jar in a servlet/war that makes the client webservice calls. I'm getting the following error:
INFO: 2011 Apr 14 14:57:32,780 MDT [http-thread-pool-8181(4)] ERROR my.package.ClientServlet - Caught exception
java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)
at my.package.Client.<init>(Client.java:54)
at my.package.ClientServlet.testService(TestServlet.java:118)
I came across this post http://yaytay.wordpress.com/2010/03/06/lsned-29-persuading-jdk-6-to-use-cxf-classes-rather-than-its-own-avoiding-seistub/ which says to fix the problem you need to include cxf-rt-frontend-jaxws as a dependency, which I do. So, that isn't the problem/solution in my case.
My client jar pom has these dependencies:
<properties>
<cxf.version>2.3.3</cxf.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-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
The servlet war contains the following in its lib:
asm-3.3.jar
bcprov-jdk15-1.45.jar
commons-logging-1.1.1.jar
cxf-api-2.3.3.jar
cxf-common-schemas-2.3.3.jar
cxf-common-utilities-2.3.3.jar
cxf-rt-bindings-soap-2.3.3.jar
cxf-rt-bindings-xml-2.3.3.jar
cxf-rt-core-2.3.3.jar
cxf-rt-databinding-jaxb-2.3.3.jar
cxf-rt-frontend-jaxws-2.3.3.jar
cxf-rt-frontend-simple-2.3.3.jar
cxf-rt-ws-addr-2.3.3.jar
cxf-rt-ws-security-2.3.3.jar
cxf-tools-common-2.3.3.jar
geronimo-javamail_1.4_spec-1.7.1.jar
jaxb-impl-2.1.13.jar
log4j-1.2.14.jar
neethi-2.0.4.jar
my-client-cxf-1.0.jar
serializer-2.7.1.jar
slf4j-api-1.4.2.jar
slf4j-log4j12-1.4.2.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.0.8.jar
wsdl4j-1.6.2.jar
wss4j-1.5.11.jar
xalan-2.7.1.jar
xml-resolver-1.2.jar
XmlSchema-1.4.7.jar
xmlsec-1.4.4.jar
I've also read some posts that talk about a javax.xml.ws.spi.Provider file, but haven't been able to find any references that detail what it should be named, contain and placed.
Can anybody point me in the right direction?
ClassCastException (SEIStub/ClientProxy)
Posted by Shelli Orton <Sh...@sjrb.ca>.
Hi,
I'm trying to build a client jar file to access a webservice. I'm including the jar in a servlet/war that makes the client webservice calls. I'm getting the following error:
INFO: 2011 Apr 14 14:57:32,780 MDT [http-thread-pool-8181(4)] ERROR my.package.ClientServlet - Caught exception
java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)
at my.package.Client.<init>(Client.java:54)
at my.package.ClientServlet.testService(TestServlet.java:118)
I came across this post http://yaytay.wordpress.com/2010/03/06/lsned-29-persuading-jdk-6-to-use-cxf-classes-rather-than-its-own-avoiding-seistub/ which says to fix the problem you need to include cxf-rt-frontend-jaxws as a dependency, which I do. So, that isn't the problem/solution in my case.
My client jar pom has these dependencies:
<properties>
<cxf.version>2.3.3</cxf.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-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
The servlet war contains the following in its lib:
asm-3.3.jar
bcprov-jdk15-1.45.jar
commons-logging-1.1.1.jar
cxf-api-2.3.3.jar
cxf-common-schemas-2.3.3.jar
cxf-common-utilities-2.3.3.jar
cxf-rt-bindings-soap-2.3.3.jar
cxf-rt-bindings-xml-2.3.3.jar
cxf-rt-core-2.3.3.jar
cxf-rt-databinding-jaxb-2.3.3.jar
cxf-rt-frontend-jaxws-2.3.3.jar
cxf-rt-frontend-simple-2.3.3.jar
cxf-rt-ws-addr-2.3.3.jar
cxf-rt-ws-security-2.3.3.jar
cxf-tools-common-2.3.3.jar
geronimo-javamail_1.4_spec-1.7.1.jar
jaxb-impl-2.1.13.jar
log4j-1.2.14.jar
neethi-2.0.4.jar
my-client-cxf-1.0.jar
serializer-2.7.1.jar
slf4j-api-1.4.2.jar
slf4j-log4j12-1.4.2.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.0.8.jar
wsdl4j-1.6.2.jar
wss4j-1.5.11.jar
xalan-2.7.1.jar
xml-resolver-1.2.jar
XmlSchema-1.4.7.jar
xmlsec-1.4.4.jar
I've also read some posts that talk about a javax.xml.ws.spi.Provider file, but haven't been able to find any references that detail what it should be named, contain and placed.
Can anybody point me in the right direction?
RE: wsdl2java - Set Java Version?
Posted by Shelli Orton <Sh...@sjrb.ca>.
I went with option 2 and it worked. Thanks so much for the help!!
Shelli
-----Original Message-----
From: Freeman Fang [mailto:freeman.fang@gmail.com]
Sent: Wednesday, April 13, 2011 8:58 PM
To: users@cxf.apache.org
Subject: Re: wsdl2java - Set Java Version?
Hi,
wsdl2java generate code have
Service
(java
.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
is per jaxws 2.2 spec, however java6 build-in jaxws 2.1 api which
cause compile error
You have 2 options to work around it
1. endorsed jaxws2.2 and jaxb2.2 api in your jdk, take a look at [1]
to get more details
2. as you're using cxf 2.3.3, you can use a new flag for wsdl2java
tool introuducd from cxf 2.3.3
wsdl2java -frontend jaxws21
to generate code which is jaxws2.1 api compatible.
Freeman
[1]http://cxf.apache.org/docs/23-migration-guide.html
On 2011-4-14, at 上午2:04, Shelli Orton wrote:
> Hi,
>
> I'm brand new to CXF and am trying to create a client from WSDL. I
> have
> used Metro and Axis in the past. I downloaded apache-cxf-2.3.3 and
> used
> wsdl2java to generate the client stubs. I use Maven and set it up my
> pom with this:
>
> <properties>
> <cxf.version>2.3.3</cxf.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>org.apache.cxf</groupId>
> <artifactId>cxf-rt-ws-security</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <inherited>true</inherited>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> <optimize>true</optimize>
> <debug>true</debug>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> When I build the project, I get these errors:
>
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
> (default-compile) on project client-cxf: Compilation failure:
> Compilation failure:
> [ERROR]
> \Devel\Projects\Client-CXF\src\main\java\my\webservice
> \ServiceRuntimeExc
> eption.java:[38,149] cannot find symbol
> [ERROR] symbol : method required()
>
> and
>
> [ERROR]
> \Devel\Projects\Client-CXF\src\main\java\my\snmpv2\MyService.java:
> [76,8]
> cannot find symbol
> [ERROR] symbol : constructor
> Service
> (java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFe
> ature[])
> [ERROR] location: class javax.xml.ws.Service
>
> The wsdl2java generated code producing the error is:
>
> It appears that the problems are related to the fact that the
> generated
> code uses Java 6 features ("require" element for XmlElementRef, new
> constructors for Service) yet the CXF Maven dependencies are for
> Java 5.
>
> Is there a way to specify that the generated code should be Java 5
> compliant?
>
> Thanks!
>
> Shelli
>
>
>
---------------------------------------------
Freeman Fang
FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference
Re: wsdl2java - Set Java Version?
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
wsdl2java generate code have
Service
(java
.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
is per jaxws 2.2 spec, however java6 build-in jaxws 2.1 api which
cause compile error
You have 2 options to work around it
1. endorsed jaxws2.2 and jaxb2.2 api in your jdk, take a look at [1]
to get more details
2. as you're using cxf 2.3.3, you can use a new flag for wsdl2java
tool introuducd from cxf 2.3.3
wsdl2java -frontend jaxws21
to generate code which is jaxws2.1 api compatible.
Freeman
[1]http://cxf.apache.org/docs/23-migration-guide.html
On 2011-4-14, at 上午2:04, Shelli Orton wrote:
> Hi,
>
> I'm brand new to CXF and am trying to create a client from WSDL. I
> have
> used Metro and Axis in the past. I downloaded apache-cxf-2.3.3 and
> used
> wsdl2java to generate the client stubs. I use Maven and set it up my
> pom with this:
>
> <properties>
> <cxf.version>2.3.3</cxf.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>org.apache.cxf</groupId>
> <artifactId>cxf-rt-ws-security</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <inherited>true</inherited>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> <optimize>true</optimize>
> <debug>true</debug>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> When I build the project, I get these errors:
>
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
> (default-compile) on project client-cxf: Compilation failure:
> Compilation failure:
> [ERROR]
> \Devel\Projects\Client-CXF\src\main\java\my\webservice
> \ServiceRuntimeExc
> eption.java:[38,149] cannot find symbol
> [ERROR] symbol : method required()
>
> and
>
> [ERROR]
> \Devel\Projects\Client-CXF\src\main\java\my\snmpv2\MyService.java:
> [76,8]
> cannot find symbol
> [ERROR] symbol : constructor
> Service
> (java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFe
> ature[])
> [ERROR] location: class javax.xml.ws.Service
>
> The wsdl2java generated code producing the error is:
>
> It appears that the problems are related to the fact that the
> generated
> code uses Java 6 features ("require" element for XmlElementRef, new
> constructors for Service) yet the CXF Maven dependencies are for
> Java 5.
>
> Is there a way to specify that the generated code should be Java 5
> compliant?
>
> Thanks!
>
> Shelli
>
>
>
---------------------------------------------
Freeman Fang
FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference