ejb@glassfish.java.net

problems with ejb

From: Daniel Benítez <danibenitez_at_hotmail.com>
Date: Fri, 26 Sep 2008 16:40:46 +0200

Hi people,

I'm trying to create a EJB with Netbeans Enterprise Aplication but I can't
run it. I have a client and ejb modules, without web application module. In
my ejb project I have created an interface with @remote tag, and other class
with @stateless tag which implements the interface.

Then, I create a class in a client module and I defined a static variable
of the interface type. In this class I try to call the remote method.
Finally I create a main class which calls the client class, but the static
EJB variable is null in all cases.

What is my problem? I post too the client classes.


/// MAIN CLASS
public class Main {


    public static void main(String args[]) {
        StatelessSessionClase mSta = new StatelessSessionClase();
        mSta.getMemoriaServer("Peticion de memoria");

    }
}

/// CLASS WITH STATIC EJB VARIABLE
public class StatelessSessionClase {

   @EJB
   private static StatelessSession sless;

  public void getMemoriaServer(String Mensaje) {

    String Memoria = sless.getMemoriaServer();
    System.out.println(Mensaje + " " + Memoria);

   }

}

thank you!

Daniel Benítez.