1 Reply Latest reply on Dec 10, 2014 4:14 AM by kpiwko

    Receive error Unable to find contextual data of type: javax.servlet.http.HttpServletRequest for Arquillian test

    davidj

      Hi,

      I'm receiving an error when I attempt to run an Arquillian test.  The error is:

       

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

       

      The relevant part of the Arquillian test looks like this:

       

      return ShrinkWrap.create(WebArchive.class, "finance.war")

          .addAsLibraries(giftcardEntity)                 // This is a JAR file containing JPA Entities

          .addPackage("com.acme.finance.ejb.giftcard")    // This is a stateless EJB (nothing fancy)

          .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

       

      The EJB is simple but it is also a REST service (using the @Path annotation) has the following attribute:

      @Context

      private HttpServletRequest request;

       

      If I remove the above "request" attribute, the test works.

       

      Any ideas?

       

      Thanks,

       

      David