1 Reply Latest reply on Jul 21, 2017 5:41 AM by Allen Jebakumar

    test resteasy interface throws exception "Unable to find contextual data of type"

    Mark Lybarger Apprentice

      I have a switchyard service that is exposed by a rest interface.

       

      The service method uses the HttpServletRequest object injected by resteasy using @Context annotation.  When running in FSW container, the execution works fine, however, when executing in a SwitchYardRunner test case using HTTPMixIn/CDIMixIn, the system throws this exception:

       

      • org.jboss.resteasy.spi.LoggableFailure: Unable to find contextual data of type: javax.servlet.http.HttpServletRequest

            at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:56)

            at com.sun.proxy.$Proxy89.toString(Unknown Source)

            at org.apache.camel.util.MessageHelper.extractBodyForLogging(MessageHelper.java:239)

       

      Steps to recreate:

      git clone https://github.com/mlybarger/quickstarts.git --branch 1.1.0.Final-ML quickstarts

      cd quickstarts/rest-binding

      mvn test