6 Replies Latest reply on Dec 29, 2012 3:39 AM by Meena Rajnai

    EJB dependency injection returns null in application container client

    Meena Rajnai Newbie

      Hi

       

      I want to do some performance testing for my algorithm. I need to run the  the client from inside the container so that the time I get should be actually for the read and update rather than invoking a remote command to server.

       

      I am trying this example http://glassfish.java.net/javaee5/ejb/examples/Sless.html  with JBOSS 6.0 and Eclipse Indigo SR2.

       

      So far the ejb is being deployed on server successfully, also the Client  ENC container is starting STARTED CLIENT ENC CONTAINER: NewAppClient

       

      When I am runing client application from eclipse it is returning null for dependency injection. 

      Exception in thread "main" java.lang.NullPointerException

                at Main.main(Main.java:11)

       

      Here is code for the client

       

       

      import ejb30.Sless;

      import ejb30.SlessBean;

      public class Main {

                // @EJB(name="NewApp/SlessBean/remote-ejb30.Sless")

                   @EJB

                   public static Sless sless;

                public static void main(String[] args) {

       

                           System.out.println(sless.toString());

                      //  System.out.println("Sless bean says : " + sless.hello());

                }

       

       

                /* (non-Java-doc)

                 * @see java.lang.Object#Object()

                 */

                public Main() {

                          super();

                }

       

       

      }

       

       

       

       

      I have gone through this wiki tut https://community.jboss.org/wiki/HowToUseAnApplicationClientInJBoss-5to too but still unable to figure it out, how will it work.

      I have attached server log and the jar files too.

       

      I am not much familiar working from command line so it will be great if some one help me getting this done through eclipse IDE.

       

      Thanks

       

      Meena