EJB - Lookup failed for 'ejb/BookRequestBean'
There can be several reasons to this:
1) Your EJB
is not mapped to JNDI name. You need to check whether your EJB
is deployed successfully and it is mapped to JNDI name. You can check Server GUI
, Server Log on startup
or use Universal Test Client
to see if EJB
is mapped correctly. Note, UTC
will only show Remotely exposed EJBs.
2) Your EJB
is only exposed to Local application. In this case, Remote call or Cross application call(different EAR, WAR...) to your EJB
will fail. In this scenario, create Remote interface and expose it. Local interface exposes EJB to only local calls. Remote interface exposes EJB to remote or cross application calls.
3) Your RMI/IIOP
port may be incorrect. You can check Glassfish GUI
or Server startup log
to see what port RMI/IIOP
is assigned to.
Note: To diagnose the exact problem, please post full stack trace.
In addition to nice @RaviTrivedi answer, here are few thoughts:
@Named
annotation shouldn't be used this way- don't use both
name
andmappedName
, for Glassfish it is enough to use justmappedName
- your EJB should implement remote interface
Adding to @Ravi Trivedi and @Miljen Mikic, if you are using Glassfish, you should check how your EJB is registered in JNDI. In Glassfish for example type the following command:
asadmin list-jndi-entries