Hi there.
I'm trying to migrate a working CXF web service from Jboss 4.2.3 with CXF
2.1 to Jonas 5.1 with CXF 2.2.5 / Spring 2.5.6 with Maven integration. The
source code should be identical between the two platforms. Well, I hope so.
So I managed to maven compile my new cxf.war and deployed it successfully
into J2EE application server Jonas 5.1.
For that, I was obliged to use classloader-default-filtering.xml with this :
<filter-name>org.apache.commons.digester.*</filter-name>
<filter-name>org.springframework.*</filter-name>
<filter-name>net.sf.cglib.*</filter-name>
<filter-name>org.objectweb.asm.*</filter-name>
<filter-name>org.apache.cxf.*</filter-name>
My CXF project is a module of a project called OrangeOpenCloud Here are some
extract of POM.XML :
<parent>
<artifactId>OrangeOpenCloud</artifactId>
<groupId>com.francetelecom.orange-open-cloud</groupId>
<version>3.0</version>
</parent>
<groupId>com.francetelecom.orange-open-cloud</groupId>
<artifactId>OrangeOpenCloud-cxf</artifactId>
<version>1.1</version>
<packaging>war</packaging>
<name>OrangeOpenCloud CXF project</name> <properties>
<cxf.version>2.2.5</cxf.version>
<spring.version>2.5.6</spring.version>
</properties>
...
My RESTful Web Service is defined in beans.xml <bean id="restflexiblecloud"
class="com.francetelecom.flexiblecloud.rest.RestFlexibleCloud" />
And now what's happened :
Into the class RestFlexibleCloud there is this method for example :
@GET
@Path("/servers")
@Produces( { "application/xml", "application/json" })
public VmInfos listServers(@HeaderParam("Authorization") String authHeader)
{ ... }
Which calls another method here : for (ServerInfo serverInfo :
flexibleCloudWS.listServers(authentication, null))
The so called class is defined like this :
public class FlexibleCloudWS implements IFlexibleCloudWS { ... }
When I called my WS with a client, there is
java.lang.ClassCastException:
com.francetelecom.virt.integration.VirtualServerVO at
com.francetelecom.flexiblecloud.impl.FlexibleCloudWS.listServers(FlexibleCloudWS.java:90)
at
com.francetelecom.flexiblecloud.rest.RestFlexibleCloud.listServers(RestFlexibleCloud.java:112)
VirtualServerVO is a POJO business class which is packaged in a jar
accessible into the classpath. Nothing particular with it.
The java.lang.ClassCastException occured exactly here :
for (VirtualServerVO virtualServerVO : arrayVS) {... } With
ArrayList<VirtualServerVO> arrayVS = new ArrayList<VirtualServerVO>();
I didn't have this problem with Jboss. CXF version was 2.1, but I tried this
version too with Jonas and same error... I tried to decompose the foreach,
and the exception occured when I did something like
arrayVS.get(0).getDescription;
I am really tired of searching the solution after two days...
Thanks for your help.
Serge
--
View this message in context:
http://old.nabble.com/java.lang.ClassCastException-with-CXF-2.2.5-JAX-RS-tp27714241p27714241.html
Sent from the cxf-user mailing list archive at Nabble.com.