@Remote
which I would imagine can very well occur cross-machine/server.
If it indeed only resolves internal lookups to machine/server I'd appreciate it if someone could point me to the right direction with res开发者_开发百科pect to how to use it with @Remote
between servers (I'm guessing somewhere I need to prefix the host name).
Thanks,
IttaiYou can call EJB component from another machine that's why @Remote anotation exists.Like
String host = "10.1.1.111";
String port = "3700";
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("org.omg.CORBA.ORBInitialHost", host);
props.setProperty("org.omg.CORBA.ORBInitialPort", port);
InitialContext ctx = new InitialContext(props);
TestService ejb = (TestService)ctx.lookup("java:global/XXX/XXX/TestEntityFacade!com.test.service.TestService");
ejb.findAll();
In that case you can use mention it in descriptor file then you can inject it using @EJB
@EJB(name="fooejbref")
private FooRemote fooRemote;
Within sun-web.xml :
<ejb-ref>
<ejb-ref-name>fooejbref</ejb-ref-name>
<jndi-name>corbaname:iiop:host2:3700#Foo</jndi-name>
</ejb-ref>
for details please please look this url http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
精彩评论