This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to Call differ session beans... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to Call differ session beans..." Watch "How to Call differ session beans..." New topic
Author

How to Call differ session beans...

T.J. Barry
Greenhorn

Joined: Jan 12, 2012
Posts: 1
I have a servlet that I want to call different session beans that utilize the same Interfaces (home and remote). Is this possible?
For instance:

Object o = new InitialContext().lookup("java:comp/env/testEJB");
TestHome home = (TestHome)javax.rmi.PortableRemoteObject.narrow(o, TestHome.class);

I know that in the interface I put


public interface TestHome extends javax.ejb.EJBHome {
public static final String COMP_NAME = "java:comp/env/ejb/TestSessionBean";
public static final String JNDI_NAME = "ejb/org/test/TestHome";

What if I want the Bean I call to be dynamic? like I pass the COMP_NAME...is this possible? Or am I going about this the wrong way?
Any help would be appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Call differ session beans...
 
Similar Threads
ejb myclipse weblogic error
could not find <ejb-local-ref>'s local interface
little help with start ejb testing
error while running EJB from java client on JBOSS
ejb create() Error java.lang. IllegalStateEx: Failed to find method for hash