• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

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

 
Ranch Hand
Posts: 31
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic