3 Replies Latest reply on Mar 16, 2009 1:16 PM by pmuir

    Calling a Web Bean from a Servlet JBoss 5

      The webbean reference says you're able to call a webbean from a servlet in Java EE 6:


      http://docs.jboss.org/webbeans/reference/1.0.0.BETA1/en-US/html_single/#d0e3256


      Will this feature work with a jboss 5.X release and the jsr299-reference implementation or do I really have to wait for a Java EE 6 compliant app server?

        • 1. Re: Calling a Web Bean from a Servlet JBoss 5
          pmuir

          Unfortunately the servlet integration with JBoss isn't done yet :-( Read https://jira.jboss.org/jira/browse/WBINT-5 for more.


          This may take a while to resolve - Web Beans provides the API, but due to the fact that the Tomcat injection code has yet to be build on JBoss MC, we are missing hooks to cause injection to happen. If you want to use Web Beans with servlets, you can look up the manager in JNDI (as described in the manual) and call manager.getInstanceByType() still.

          • 2. Re: Calling a Web Bean from a Servlet JBoss 5

            WBINT-5 is Scheduled for 5.2.0.Beta-2. If this referes to a JBoss Version it mean at leas we don't have to wait for JBoss 6.


            Thanks for pointing out the manager.getInstanceByType() workaround. Although this is more a ServiceLocator than a DI pattern it should get as started.

            • 3. Re: Calling a Web Bean from a Servlet JBoss 5
              pmuir

              The version numbering for WBINT is weird ;-) 5.2.0.Beta2 is the release for Web Beans Beta2. I hope we can get it in for then - but there may be some refactor of JBoss code needed, which wouldn't happen for the 5.1 serieis I think - I'm currently waiting on JBoss AS / JBossWeb experts.