EJB convert between local and remote interface


I am writing an EJB. I want to be able to convert from local to remote interface, and from remote to local interface.

If f.ex I have a EJB called ABean, with local interface ALocal and remote interface ARemote. How can I get the ALocal interface when I have the corresponding ARemote interface. And how can I get the ARemote interface when I have the corresponding ALocal interface.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the EBJ's SessionContext, EntityContext, or MessageDrivenContext object. These have getEJBLocalObject and getEJBObject methods.  As the names suggest SessionContext is use with session beans, EntityContext is used with entity beans, and MessageDrivenContext is use with message driven beans.

steffAuthor Commented:
According to the JavaDoc that comes with JBuilder 6, SessionContext only has getEJBObject, and NOT getEJBLocalObject.

Is the JavaDoc wrong?
What version of the EJB  does JBuilder 6 implement?  
My information came from the Mastering Enterprise JavaBeans (2nd Editon) book that covers EJB 2.0.  Accoring to this SessionContext must implement the EJBContext interface that has a getEJBLocalObject interface.  But since it's a container object JBuilder may have chosen not to provide a working implementation of getEJBLocalObject.  

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to klf

Please leave any comments here within the
next seven days.


Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.