I cannot figure out the lookup syntax for my Java bean on a Glassfish 4.1 server. Here is the bean info:
@Stateless
@Named("ServiceBean")
@Remote(IServiceBean.class)
public class ServiceBean {
/**
*
*/
public ServiceBean() {
// Pass
}
public String getMessage() {
return "This is the message";
}
}
Here is the remote interface:
@Remote
public interface IServiceBean {
public String getMessage();
}
Here is the code I've tried:
String context = "corbaname:iiop:localhost:3700#java:global/GBEAP/ServiceEJB";
InitialContext ctx = new InitialContext();
NamingEnumeration<NameClassPair> list = ctx.list(context);
while (list.hasMore()) {
System.out.println("Name->" + list.next().getName());
}
Object o = ctx.lookup(context + "/ServiceBean!mikeski.IServiceBean");
System.out.println("Object is: " + o.getClass().toString());
The list and loop prints:
Name->ServiceBean__3_x_Internal_RemoteBusinessHome__
Then I get a NameNotFoundException for the ctx.lookup method call.
I have tried all kinds of things for the lookup, including:
/ServiceBean!IServiceBean
/ServiceBean!mikeski.IServiceBean // The FQ package name
/ServiceBean__3_x_Internal_RemoteBusinessHome__
Nothing works. The Glassfish UI application components list has an entry for:
ServiceEJB.jar ServiceBean StatelessSessionBean
In the table under the GBEAP app, so I know the bean is there.
Any idea?
Aucun commentaire:
Enregistrer un commentaire