I am using Glassfish 4. And I have an EAR which has a WAR and a JAR (with the EJBs).
I want to call the EJBs from my WAR but am not really sure if I need to use Local or Remote interfaces.
Inside my JAR, my Bean looks like this :
@Stateless
public class Test implements TestLocal {
@Override
public void testing() {
}
}
And my local :
@Local
public interface TestLocal {
void testing();
}
Inside my WAR I have a web service and it looks like this :
@WebService(serviceName = "TestWS")
public class TestWS {
private @EJB TestLocal testBean;
@WebMethod(operationName = "test")
public String test() {
testBean.test();
}
}
Both of these are packaged into an EAR.
When I call my WebService method I get an AccessLocalException :
Warnung: javax.ejb.AccessLocalException: Client not authorized for this invocation at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1895) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
Firstly :
- Is this the correct way to call the EJB. Can a WAR inside an EAR use Local interfaces from an included JAR?
- If so then does anyone know what I am doing wrong? Do I need to setup some kind of security configuration?