2 Replies Latest reply on Feb 17, 2006 5:06 AM by Trevor Harris

    @EJB  resource injection fails in client

    Trevor Harris Newbie

      I am trying to access a stateless session bean remotely from a client with

      @EJB(mappedName="mailserver/TestStatelessEJB/remote") TestStatelessRemote r;

      but r remains set to null.

      Using the normal InitialContext lookup works fine.

      Am I doing something wrong or is this not spuuorted yet.

      Regards Trevor

        • 1. Re: @EJB  resource injection fails in client
          Peter Westlin Newbie

          You can only inject EJB into objects that are managed by the container(other EJBs, servlets, ...).

          The "mappedBy" attribute tells the container what name the EJB should have at deploy time.

          Regards Peter

          • 2. Re: @EJB  resource injection fails in client
            Trevor Harris Newbie

            The EJB3 simplified spec does require injection to be available in remote clients eg section 4.2

            The local or remote client of a session bean acquires a reference to a session bean business interface through one of the dependency injection or lookup mechanisms described in Chapter 8.

            The specs also talk about 'Application Client Containers' which are supplied by some implementations to execute client applications contained in ear files. As I understand Jboss does not include a specific container and clients are built as a normal application. I see no reason why Jboss cannot support injection in remote clients as required by the spec.