Hi all.
I'm trying to migrate from EJB2.x to EJB3.x but i'm facing some problems with the lookup.
I was using JBoss 4.2.2 and I migrated to wildfly 9.0.0 Full. This is all ok, working fine.
The problem is as follows:
I have an interface that extends EJBHome and has the create() method header;
I have an interface that extends EJBObject and has other method headers;
I also have a class with the code below (it's a servlet):
public class WUFAction { public void doPost(HttpServletRequest request, HttpServletResponse response) { WUFFacadeRemote engine; InitialContext ic = new InitialContext(); Oject objRef = ic.lookup("java:comp/env/wUF"); com.wuf.WUFFacadeHome home = (com.wuf.WUFFacadeHome) PortableRemoteObject.narrow(objRef, com.wuf.WUFFacadeHome.class); engine = home.create(); ... ... } }
This class will become a @WebServlet and the new code should be something like this (I guess):
@WebServlet public class WUFAction { @EJB WUFFacadeHome facadeHome; public void doPost(HttpServletRequest request, HttpServletResponse response) { WUFFacadeRemote engine; ... ... engine = facadeHome.create(); ... } }
But always I get a NullPointerException at facadeHome, doesn't matter what I try to do, even changing from @EJB to @Inject, changing the .class files to the same package, annotating the interfaces with @Remote, ou @RemoteHome or other stupid tries.
I'm using WildFly Full 9.0.0.Final, starting with no errors.
JNDI bindings are processed with no errors too.
I really don't know what i'm doing wrong (maybe i'm doing all wrong, i'm sorry for that, but i'm a bit lost here.)
Thank you.