I manage succesefully to lookup remoteley beans using InvocationContext. I also manage succesefully to lookup bean using anotations. But when i tried to use sessionContext.lookup I have class cast exception. What I am doiing wrong?
Code example:
public class ZRepositoryBean implements ZRepository, ZLocalRepository {
@PersistenceContext(unitName = "zert")
private EntityManager manager;
//works
@Resource
private SessionContext context;
//works
@EJB
private ZLocalSecurityManager securityManager;
//works
@EJB
private ZLocalQueryManager queryManager;
private void invokeOtherBean() {
Class cast exception
ZOtherLocal other =
(ZOtheeLocal)context.lookup("java:module/ZOtherLocalBean!"
+ZOtherLocal.class.getName());
//invokactio via ejb:// works good when i am not inside been or use it remotelly
}