开发者

@Local annotation in EJB 3

I have a stateless session bean and a standalone-java-program acting as a client. The 开发者_如何学Cbean method executes just fine when the interface is marked @Remote. However,when I mark that interface with @Local instead of @Remote, I get the following Exception.

 [java] javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Could not find InvokerLocator URL at JNDIaddress "chapter1/HelloUserBean/local"; looking up local Proxy from Remote JVM?]

But I expected even the latter to work, since it is the same computer that the code executes in.

Seeing this behavior, I am assuming that, the Application-Server and the Standalone-Java-Program use different JVM instances and not a single JVM instance and so this client can access only through a remote interface.

Is that assumption correct ?

Thanks !


Yes, it is correct.

@Local interfaces are to be used only within the same application-server. The application server starts one JVM instance, and your standalone client starts another.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜