This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to access a Bean in From Separate EAR. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to access a Bean in From Separate EAR." Watch "How to access a Bean in From Separate EAR." New topic

How to access a Bean in From Separate EAR.

Tina Jain

Joined: Mar 17, 2006
Posts: 23
Hi Hello every one.

I am using WSAD 5.1.2 and EJB 2.1

I have a LoginSession session bean in


i want to access the session bean in my struts project.


How can I access the LoginSession bean in the ShoppingEAR from the Web Project?

I have done the same thing before but, before my LogginSession Bean was in the WebWorkEar.

Any Help will be of great help.

Thanks for your time.
Have a nice time.

If You Cannot Give Anything, At least Give A Smile.
Dave Salter
Ranch Hand

Joined: Jul 20, 2005
Posts: 293

You should be able to look up the bean's remote home interface and then call create() to create an instance of the bean.
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977

you need to have the EJB client classes(remote and homeRemote) on the client side, in your case the webapp that needs to use the EJB.
Mehul Mistry
Ranch Hand

Joined: Feb 10, 2006
Posts: 43
What Marcos, said above is exactly what you have to do. And you have to write your client code in your struts login Action class. Thats how you'd do a look up from the struts application.
[ October 27, 2006: Message edited by: Mehul Mistry ]
Tina Jain

Joined: Mar 17, 2006
Posts: 23
Means the only thing we need is client.jar file, when we deploy a bean.

I would like to thank each one of you for taking time, I was able to solve the problem, from your hints.

Have a nice day and weekend.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17271

Before you put it directly in your Action class, you should look at some best practices, which include using the ServiceLocator pattern to get access to your Beans, instead of tying(tightly coupling) EJB directly in your Struts code.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Have you checked out Aspose?
subject: How to access a Bean in From Separate EAR.
It's not a secret anymore!