The following code
@WebMethod(operationName = "echoOperation")
@WebResult(name = "echoResult")
public String echo(@WebParam(name = "map") Map<String, ?> map) {
return "test passed";
}
throws ClassCastException.
12:37:28,828 [ERROR] [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'handlerMappingForWebServices' defined in ServletContext resource [/WEB-INF/applicationContext-webServices.xml]: Initialization of bean failed; nested exception is org.codehaus.xfire.XFireRuntimeException: Couldn't load provider.. Nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
org.codehaus.xfire.XFireRuntimeException: Couldn't load provider.. Nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
at org.codehaus.xfire.aegis.type.AbstractTypeCreator.createMapType(AbstractTypeCreator.java:135)
at org.codehaus.xfire.aegis.type.AbstractTypeCreator.createTypeForClass(AbstractTypeCreator.java:67)
at org.codehaus.xfire.aegis.type.AbstractTypeCreator.createType(AbstractTypeCreator.java:207)
at org.codehaus.xfire.aegis.AegisBindingProvider.getParameterType(AegisBindingProvider.java:184)
at org.codehaus.xfire.aegis.AegisBindingProvider.initializeMessage(AegisBindingProvider.java:128)
at org.codehaus.xfire.aegis.AegisBindingProvider.initialize(AegisBindingProvider.java:96)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.create(ObjectServiceFactory.java:243)
at org.codehaus.xfire.annotations.AnnotationServiceFactory.create(AnnotationServiceFactory.java:117)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.create(ObjectServiceFactory.java:150)
at org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping.initApplicationContext(Jsr181HandlerMapping.java:66)
Not quietly sure, but the problem seem to be in the following:
org.codehaus.xfire.aegis.type.AbstractTypeCreator
protected Type createMapType(TypeClassInfo info)
{
//...
MapType type = new MapType(schemaType,
(Class) info.getKeyType(),
(Class) info.getGenericType());
//...
}
(Class) info.getGenericType() is the reason of bad class cast
Sorry, can't figure out the real reason. 