cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Marin (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CXF-3470) WildcardTypeImpl cannot be cast to java.lang.Class - Class Cast exception thrown after upgrading from 2.2.3 to 2.4.0
Date Mon, 25 Apr 2011 16:53:03 GMT
WildcardTypeImpl cannot be cast to java.lang.Class - Class Cast exception thrown after upgrading
from 2.2.3 to 2.4.0
--------------------------------------------------------------------------------------------------------------------

                 Key: CXF-3470
                 URL: https://issues.apache.org/jira/browse/CXF-3470
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS, JAXB Databinding
    Affects Versions: 2.4, 2.3.2
         Environment: java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
            Reporter: Carlos Marin
             Fix For: 2.2


My project was working fine with CXF version 2.2.3. After trying to upgrade to 2.3.2 and 2.4.0,
in both cases I'm getting the following exception:

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot
be cast to java.lang.Class
	at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:204)
	at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:209)
	at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:209)
	at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:192)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.compareClasses(ProviderFactory.java:778)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.access$400(ProviderFactory.java:61)
	at org.apache.cxf.jaxrs.provider.ProviderFactory$ClassComparator.compare(ProviderFactory.java:760)
	at java.util.Arrays.mergeSort(Arrays.java:1270)
	at java.util.Arrays.sort(Arrays.java:1210)
	at java.util.Collections.sort(Collections.java:159)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:508)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:304)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1004)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:594)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:559)
	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
...
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:680)




Method declaration is like (not working in CXF v2.4.0... but worked fine in v2.2.3):

    @POST
    @Path("mypath")
    @Consumes({"application/json", "application/xml"})
    public JAXBElement<MyElement> methodName(JAXBElement<? extends ParentClass>
zzz)


Workaround is to declare method like:

    @POST
    @Path("mypath")
    @Consumes({"application/json", "application/xml"})
    public JAXBElement<MyElement> methodName(ParentClass zzz)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message