Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-1722

Unable to inject javax.ws.rs.core.Configuration into the resource

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.0.0.ER4
    • 7.0.0.DR13 (Alpha)
    • REST
    • None

    Description

      To EAP 7 I deploy application with this Application class:

      @ApplicationPath("/")
      public class ApplicationPropertiesConfig extends Application {
          @Override
          public Map<String, Object> getProperties() {
              return Collections.<String, Object>singletonMap("Prop1", "Value1");
          } 
      

      And with resource below, injecting javax.ws.rs.core.Configuration with @Context annotation:

      @Path("/")
      public class ApplicationPropertiesConfigResource {
      
          @Context
          private Configuration configuration;
      
          @GET
          @Path("/getconfigproperty")
          public String getProperty(@QueryParam("prop") String prop) {
              String value = (String)configuration.getProperty(prop);
              return value;
          }
      

      This results to following exception:

      16:34:08,310 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002005: Failed executing GET /getconfigproperty: org.jboss.resteasy.spi.LoggableFailure: RESTEASY003880: Unable to find contextual data of type: javax.ws.rs.core.Configuration
      	at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:55)
      	at com.sun.proxy.$Proxy35.getProperty(Unknown Source)
      	at org.jboss.resteasy.test.core.basic.resource.ApplicationPropertiesConfigResource.getProperty(ApplicationPropertiesConfigResource.java:21)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:199)
      
      

      Issue is related to:
      http://stackoverflow.com/questions/30248956/application-deployment-specific-properties-with-jax-rs-and-wildfly

      Attachments

        Issue Links

          Activity

            People

              chaowan@redhat.com Chao Wang
              kanovotn Katerina Odabasi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: