I'm using a remote bean from a servlet to make a remote call. The code snippet 
below works. But I'm wondering is it possible to inject this bean without 
needing to do the remote JNDI lookup.

When using JMS I setup a RemoteJMSProvider and can inject both the connection 
factory and destination queue from a servlet (I'm using the web 2.5 spec).

Is something similar possible with EJB's? Or am I stuck with the JNDI lookup 
code. Maybe some kind of mbean provider where I can specify the remote machine 
IP?

Cheers,

Ross

P.S. I've commented out the @EJB annotation as it does nothing.


  | //@EJB
  | private MyTestBeanRemote remoteBean;
  | 
  | protected void doGet(HttpServletRequest request,
  |             HttpServletResponse response) throws ServletException, 
IOException {
  | 
  |     try {
  |             Properties properties = new Properties();
  |             properties.put(Context.INITIAL_CONTEXT_FACTORY,
  |                                     
"org.jnp.interfaces.NamingContextFactory");
  |             properties.put(Context.URL_PKG_PREFIXES,
  |                                     "org.jboss.naming:org.jnp.interfaces");
  |             properties.put(Context.PROVIDER_URL, "jnp://172.16.8.52:1099");
  | 
  |             Context ctx = new InitialContext(props);
  |             remoteBean = (MyTestBeanRemote) 
ctx.lookup("TestEAR/MyTestBeanRemote/remote");
  | 
  | 
  |     } catch (Exception ex) {
  |             System.out.println("Could not create bean. "+
  |                     ex.getMessage());
  |     }
  | 
  |     if (remoteBean != null) remoteBean.doSomething();
  | }
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4208628#4208628

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4208628
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to