I'm using EJB 2.1 stateless session bean in wildfly 9.
TestService testServiceLocal = (TestService) context.lookup("java:app/WildEarEJB/TestService!in.hinote.ejb.TestService");
testServiceLocal.someMethod();
While the above code works, but I was wondering if this is ok? As I'm not following the old practice of:
- Get ejb home object reference using JNDI
- Use PortableRemoteObject.narrow and typecast it to home interface.
- Use Home interface.create() to get the bean instance.
Is what I'm doing ok? Or should I find some way to follow the old practices. BTW, I tried using the home jndi and PortableRemoteObject.narrow(). But that seems to be giving a typecast error saying com.sun.proxy.$Proxy39 cannot be cast to org.omg.CORBA.Object
.