aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Remote vs Local deployment....difference??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Remote vs Local deployment....difference???" Watch "EJB Remote vs Local deployment....difference???" New topic
Author

EJB Remote vs Local deployment....difference???

Pradeep Bhat
Greenhorn

Joined: Jan 12, 2008
Posts: 29
what is the difference between deploying a stateless session bean with a remote and local interface.

This is my code :




I do the look up as
HelloUser user = (HelloUser)ctx.lookup("hhh/remote");

This works fine. But the same doesn't work for local interface.





If i do the lookup as HelloUser user = (HelloUser)ctx.lookup("hhh/local");...i get the following exception

Exception in thread "main" javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Could not find InvokerLocator URL at JNDI address "hhh/local"; looking up local Proxy from Remote JVM?]
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1472)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:818)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at HelloWorldClient.main(HelloWorldClient.java:11)
Caused by: java.lang.RuntimeException: Could not find InvokerLocator URL at JNDI address "hhh/local"; looking up local Proxy from Remote JVM?
at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.createProxyFactoryProxy(ProxyObjectFactory.java:185)
at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:146)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1447)
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1464)
... 4 more




If i do the look up as HelloUser user = (HelloUser)ctx.lookup("hhh"); ...i get the exception as

Exception in thread "main" java.lang.ClassCastException: org.jnp.interfaces.NamingContext
at HelloWorldClient.main(HelloWorldClient.java:11)





I am using jdk1.5 and jboss-5.0.1.GA.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

what is the difference between deploying a stateless session bean with a remote and local interface.


Local interfaces are meant to be used from the same JVM as the application server on which your bean is deployed. Remote interfaces can be used from other (remote) JVMs too (example standalone clients).

Exception in thread "main" javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Could not find InvokerLocator URL at JNDI address "hhh/local"; looking up local Proxy from Remote JVM?]
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1472)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:818)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at HelloWorldClient.main(HelloWorldClient.java:11)


This shows that you are using a local interface from a remote JVM (standalone client). This is not allowed and hence the exception.

[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Remote vs Local deployment....difference???