Hallo zusammen,

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

Stateless Sessionbean:
Code java:
1
2
3
4
5
6
7
8
9
10
@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:
Code java:
1
2
3
4
5
6
@Remote
public interface NewSessionBeanRemote {
 
    String businessMethod();
    
}

Client:
Code java:
1
2
3
4
5
6
7
8
9
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