• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Writing a remote client to access EJBs

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am a fairly experienced Java developer, but am new to EJBs. I've gone through some books and tutorials, and I think I basically understand how to write EJB server components. All of the sample applications that I wrote run fine.
Problem is, the client and server code of these sample apps all run on the same machine; the same JVM as well. What I am trying to do is write a separate, totally simple, Java app to run from the command line from another computer, separate from where the EJB container is running (I would access the server machine from the client machine over my home DSL hub.)
So my (hopefully simple) question is... what do I need for the client app? Do I need certain JAR files for it to run? I assume it needs the JNDI classes, but does it need any EJB-specific classes as well? How about my custom Enterprise Java Bean... do I need to copy over any of my own code for the client to use? Presumably the client would need the home and remote interfaces in its classpath, else it couldn't compile, but does it need any other of my code?
Presumably this is done all the time with EJBs, so hopefully someone knows the answer!
Thanks in advance!
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dave,
how to package your client you can find in the
Sun Tutorial.
Additional you need to set some properties to find your remote server.
Properties props= new Properties();
props.put( Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); //for JBoss Client
props.put(Context.PROVIDER_URL,"Server ort");
The Factory depends on your application server e.g.
BEA weblogic.jndi.WLInitialContextFactory
JBoss org.jnp.interfaces.NamingContextFactory
Additional you need some server dependent other jars (which should include JNDI).
Regards
Torsten
 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dave,
You will need to make sure your client has access to the Remote/Home Interfaces.
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, thanks both for replying.
It looks like part of what I need to do is figure out what classes/JARs Orion itself requires its clients to have, at least for the JNDI and EJB-specific functionality.
William, are you saying that I should copy over the actual compiled home/remote interfaces that I write & compile myself?
 
reply
    Bookmark Topic Watch Topic
  • New Topic