-
1. Re: Cannot lookup the EJB3 bean - NameNotFound exception
wdfink Nov 2, 2014 4:51 PM (in response to wilddev)How you deploy the application? From the log it looks like your client is a standalone application.
If it is a jar the lookup should be "/
server_ejb/DeployBean!interfaces.Deploy
"If it is a ear you need to add the ear's name as prefix.
-
2. Re: Cannot lookup the EJB3 bean - NameNotFound exception
wilddev Nov 2, 2014 5:25 PM (in response to wdfink)Actually yes, it's standalone. Shouldn't be?
I packaged this as .jar, pointing native jboss-client.jar lib and server_ejb artifact as dependencies; and ran it in Application mode.
-
3. Re: Cannot lookup the EJB3 bean - NameNotFound exception
wdfink Nov 4, 2014 7:06 AM (in response to wilddev)No the client can be a standalone java application.
Only the lookup depends on the server deployment.
In any case "java:" prefix does not work for a standalone application.
In your case you should see a server side logging which contain a JNDI binding like this one:
java:jboss/exported/jboss-ejb-multi-server-app-main/ejb/MainAppSContextBean!org.jboss.as.quickstarts.ejb.multi.server.app.MainApp
You need to use the name behind exported "jboss-ejb-multi-server-app-main/ejb/MainAppSContextBean!org.jboss.as.quickstarts.ejb.multi.server.app.MainApp".
This example is an ear deployment jboss-ejb-multi-server-app-main.ear.
If you have a simple jar as deployment the JNDI name would start with /ejb if you deploy an ejb.jar.
For more informations see Remote EJB invocations via JNDI
Notice that this approach is not recommended for EJB invocations (see restrictions in previous link), you should use EJB invocations from a remote client using JNDI
-
4. Re: Re: Cannot lookup the EJB3 bean - NameNotFound exception
wilddev Nov 4, 2014 9:27 AM (in response to wdfink)It has been fixed by adding
jndiProps.put(
"jboss.naming.client.ejb.context"
,
true
);
to the properties and changing lookup string to the relative like this:
.lookup("/server_ejb/DeployBean!interfaces.Deploy").
wfink, thank you for help