• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Create EJB from J2SE console app

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I it possible to remotely call a bean method from a J2SE console App?

The two are running on the same server.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephen,
You could use a J2EE application client or make remote EJB calls by looking up the initial context.
 
Stephen Hanley
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

Thanks for your reply.

That's the approach I had thought I would be able to take. It's obviously not as easy as it seems. The following is a snippet of the code i was trying:


ie.spraoi.jambo.stateful.MessageManagerHome.JNDI_NAME is my MessageManagerBean stateful session bean's home interface. Eclipse is underlining red and saying it cannot resolve it?
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephen,
Sounds like a compiler error. Check you have a jar with the EJB stubs and skeletons in your classpath.
 
Stephen Hanley
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

Thanks again for your help.

I was just discussing this with a colleague on the phone.

I am new to J2EE, RMI-IIOP, JNDI and the rest.

Do you mean I have to have the files in the folder 'ejbsrc' available to my console app?

Do I have to import my EJB Module (.jar) into the consoles class path or is that overkill?

(Or am I just out of my depth? :eek

Kind regards,

Stephen Hanley.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephen,
You aren't out of your depth Either of those is a viable solution.

If you are just testing, either of those options is fine. I recommend putting the ejb jar in your classpath (option #2.) It's overkill, but it's also the easiest. And it is generally a good practice not to include the source where it isn't needed.

If you are actually distributing this console app to others, you will want to create a jar with just the stubs and skeletons. That way callers won't have access to all your business logic.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic