Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5175

?_wadl generates a ClassCastException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.5, 2.7.6
    • 2.6.10, 2.7.7, 3.0.0-milestone1
    • JAX-RS
    • None
    • Tomcat 7.0.23, Spring 3.1.1 Java 1.6, OSX 10.8.4 (Darwin Kernel Version 12.4.0, root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64)

    • Moderate

    Description

      When using the WadlGenerator via "?_wadl", a ClassCastException is caused. Here is the stack trace:
      org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver 115 - Error occurred during error handling, give up!
      org.apache.cxf.interceptor.Fault: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
      at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:76) ~[cxf-api-2.7.6.jar:2.7.6]
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:331) [cxf-api-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-api-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:159) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:211) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) [servlet-api.jar:na]
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262) [cxf-rt-transports-http-2.7.6.jar:2.7.6]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) [catalina.jar:7.0.23]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.23]
      at com.transverse.bleep.api.TractApiServletFilter.doFilter(TractApiServletFilter.java:93) [classes/:na]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.23]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.23]
      at com.transverse.bleep.servlet.filter.MDCUserFilter.doFilter(MDCUserFilter.java:79) [classes/:na]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.23]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.23]
      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:167) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.23]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.23]
      at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147) [spring-orm-3.1.1.RELEASE.jar:3.1.1.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.23]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.23]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) [catalina.jar:7.0.23]
      at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:169) [catalina.jar:7.0.23]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) [catalina.jar:7.0.23]
      at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:168) [catalina.jar:7.0.23]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java) [catalina.jar:7.0.23]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) [catalina.jar:7.0.23]
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928) [catalina.jar:7.0.23]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.23]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.23]
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) [tomcat-coyote.jar:7.0.23]
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539) [tomcat-coyote.jar:7.0.23]
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298) [tomcat-coyote.jar:7.0.23]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [na:1.6.0_51]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [na:1.6.0_51]
      at java.lang.Thread.run(Thread.java:680) [na:1.6.0_51]
      Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
      at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:226) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:231) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:204) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.utils.ResourceUtils.checkJaxbType(ResourceUtils.java:600) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.utils.ResourceUtils.getAllTypesForResource(ResourceUtils.java:543) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.utils.ResourceUtils.getAllRequestResponseTypes(ResourceUtils.java:515) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.model.wadl.WadlGenerator.handleRequest(WadlGenerator.java:218) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.impl.RequestPreprocessor.handleMetadataRequest(RequestPreprocessor.java:216) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.impl.RequestPreprocessor.checkMetadataRequest(RequestPreprocessor.java:200) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.impl.RequestPreprocessor.preprocess(RequestPreprocessor.java:84) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:117) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:101) ~[cxf-rt-frontend-jaxrs-2.7.6.jar:2.7.6]
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) [cxf-api-2.7.6.jar:2.7.6]

      This is caused by a construct in our code like the following:
      @XmlElement(name="orderItems",required=true)
      protected OrderItemsDTO<? extends OrderItemDTO<? extends OrderItem>> orderItems;

      The problem seems to be that the class needs to recurse again in InjectionUtils#getActualType(). When I set a breakpoint and made the call manually, the problem did not occur.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            jeff9finger Jeff Haynes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: