Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-6723

CDI injection into JAX-RS service does not work when hot-deployed.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 7.1.1.Final
    • CDI / Weld, REST
    • None
    • Hide

      To reproduce the issue use following steps:
      1.) Get the reproducer from git://github.com/pmacik/jaxrs-cdi-reproducer.git
      2.) Get out-of-the-box JBoss AS7 (7.1.1.Final)
      3.) Start the AS up
      4.) Build the reproducer WAR using "mvn package"
      5.) Deploy the reproducer WAR - copy the WAR into (JBOSS_HOME)/standalone/deployments directory
      6.) Go to http://localhost:8080/JAXRS-CDI-reproducer/rest/bean/getAll -> NPE is thrown (bean was not injected)
      7.) Go to http://localhost:8080/JAXRS-CDI-reproducer/BeanServlet -> the bean is properly injected

      Show
      To reproduce the issue use following steps: 1.) Get the reproducer from git://github.com/pmacik/jaxrs-cdi-reproducer.git 2.) Get out-of-the-box JBoss AS7 (7.1.1.Final) 3.) Start the AS up 4.) Build the reproducer WAR using "mvn package" 5.) Deploy the reproducer WAR - copy the WAR into (JBOSS_HOME)/standalone/deployments directory 6.) Go to http://localhost:8080/JAXRS-CDI-reproducer/rest/bean/getAll -> NPE is thrown (bean was not injected) 7.) Go to http://localhost:8080/JAXRS-CDI-reproducer/BeanServlet -> the bean is properly injected
    • Workaround Exists
    • Hide

      Deploy WAR before AS is started:

      Workaround (deploy before AS is started):
      1.) Get the reproducer from git://github.com/pmacik/jaxrs-cdi-reproducer.git
      2.) Get out-of-the-box JBoss AS7 (7.1.1.Final)
      3.) Build the reproducer WAR using "mvn package"
      4.) Deploy the reproducer WAR - copy the WAR into (JBOSS_HOME)/standalone/deployments directory
      5.) Start the AS up
      6.) Go to http://localhost:8080/JAXRS-CDI-reproducer/rest/bean/getAll -> empty collection XML is returned (bean was injected properly))
      7.) Go to http://localhost:8080/JAXRS-CDI-reproducer/BeanServlet -> the bean is properly injected

      Show
      Deploy WAR before AS is started: Workaround (deploy before AS is started): 1.) Get the reproducer from git://github.com/pmacik/jaxrs-cdi-reproducer.git 2.) Get out-of-the-box JBoss AS7 (7.1.1.Final) 3.) Build the reproducer WAR using "mvn package" 4.) Deploy the reproducer WAR - copy the WAR into (JBOSS_HOME)/standalone/deployments directory 5.) Start the AS up 6.) Go to http://localhost:8080/JAXRS-CDI-reproducer/rest/bean/getAll -> empty collection XML is returned (bean was injected properly)) 7.) Go to http://localhost:8080/JAXRS-CDI-reproducer/BeanServlet -> the bean is properly injected

            sdouglas1@redhat.com Stuart Douglas (Inactive)
            pmacik@redhat.com Pavel Macik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: