-
1. Re: which interfaces if (remote or local) when accessing ejb
juhalindfors Jun 15, 2003 7:34 PM (in response to manfredb)As long as your servlet container is embedded into the same process you can use local interfaces from your servlets. There isn't anything special you need to do (apart from the usual and <local-home> declarations in your ejb-jar.xml), simply lookup the local proxy from the JNDI (local-jndi-name entry in your jboss.xml).
However, in case of JBoss, the same pass-by-reference optimization is done automatically even if you only expose a remote interface. The proxy is smart enough to detect that you are attempting to make a local call and optimize the argument passing semantics. -
2. Re: which interfaces (remote or local) when accessing ejb's
manfredb Jun 16, 2003 9:30 PM (in response to manfredb)Hallo Juha,
many thanks for your response. I did it like you explained. Now it works. This time it was much simpler as I thought.
The necessary definitions if someone else is interest in it
ejb-jar.xml:
<ejb-jar>
<enterprise-beans>
<display-name>Cabin</display-name>
<ejb-name>Cabin</ejb-name>
<local-home>untitled8.CabinHome</local-home>
untitled8.Cabin
<ejb-class>untitled8.CabinBean</ejb-class>
...
// other necessary definitions
</ejb-jar>
jboss.xml:
<enterprise-beans>
<ejb-name>Cabin</ejb-name>
<local-jndi-name>ejb/CabinHome</local-jndi-name>
</enterprise-beans>
display.jsp:
public void jspInit() {
...
Context jndiContext = new InitialContext();
CabinHome home = (CabinHome)jndiContext.lookup("ejb/CabinHome");
...
Once more many thanks to you. It was a great help.
Manfred