cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil (London)" <>
Subject Problem in JAXBContextInitializer.addType
Date Wed, 12 Sep 2007 15:59:06 GMT

I have tried to update from 2.0 to 2.0.1 and have come across an issue when
the service is being initialized using JAXBDatabinding.initialize(service),
and is searching through all the Class types used in the code.

One of my method parameters which in a object that extends ArrayList and
only overrides “public boolean add(Object o)”, results in a class cast

The problem occurs when it tries to add the class type for the return type
of the method:

public java.lang.Object[] java.util.ArrayList.toArray(java.lang.Object[])

java.lang.Object[] has a type of  GenericArrayTypeImpl, and therefore the
code executes the following lines of code in JAXBContextInitializer.addType:

else if (cls instanceof GenericArrayType) {
           	GenericArrayType gt = (GenericArrayType)cls;
Class ct = (Class) gt.getGenericComponentType();
            ct = Array.newInstance(ct, 0).getClass();

The genericComponentType of  GenericArrayType is TypeVariableImpl which can
not be cast to a Class, and therefore I get the following exception:

sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to

It seems that in CXF 2.0.1, the walkReferences method was added to getClass
which causes all the classes in the method parameters to be initialized –
previously this was not the case, and therefore my code worked with CXF 2.0.

Do you have any ideas? I am unfamiliar with TypeVariableImpl – is this not a

View this message in context:
Sent from the cxf-issues mailing list archive at

View raw message