EJB3 remote Client using Glassfish AA

sebastianb

Erfahrenes Mitglied
Hallo zusammen,

ich versuche nun schon eine ganze Weile meinen EJB Service von einem Remote Client aus aufzurufen:

Stateless Sessionbean:
Java:
@Stateless
public class NewSessionBean implements NewSessionBeanRemote {

    public static final String RemoteJNDIName = NewSessionBean.class.getSimpleName() + "/remote";
    public static final String LocalJNDIName = NewSessionBean.class.getSimpleName() + "/local";

    public String businessMethod() {
        return "Hello World";
    }
}

Interface:
Java:
@Remote
public interface NewSessionBeanRemote {

    String businessMethod();
    
}

Client:
Java:
Context c = new InitialContext();

        Properties properties = new Properties();
        properties.put("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
        properties.put("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
        properties.put("java.naming.provider.url", "jnp://localhost:1099");
        Context ctx = new InitialContext(properties);
        System.out.println("Got context");
        NewSessionBeanRemote ans = (NewSessionBeanRemote) ctx.lookup(NewSessionBean.RemoteJNDIName);

Leider bekomme ich immer einen NPE. Jemand eine Ahnung was hier schief läuft?

Viele Dank für Eure Hilfe!

Sebastian
 
Zurück