This content has been marked as final.
Show 6 replies
-
1. Re: How to retrieve an EJB from a JAR used in many EAR ?
jaikiran Mar 12, 2008 6:25 AM (in response to chawax)You can create a jboss.xml file and mention the jndi-name of your choice for the EJB. Something like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd"> <jboss> <enterprise-beans> <session> <ejb-name>ServiceEmployeBean</ejb-name> <jndi-name>MyBean</jndi-name> </session> </enterprise-beans> </jboss>
Place this jboss.xml in the META-INF folder of your ejb jar (same place as ejb-jar.xml). Then use this jndi-name (in this case "MyBean") in your code, to lookup the bean.
P.S: You mentioned that you use EJB3. In EJB3 you no longer need the xmls to define the beans or the jndi-name. You can use annotations to do this. See this EJBTrail for more details http://trailblazer.demo.jboss.com/EJB3Trail/ -
2. Re: How to retrieve an EJB from a JAR used in many EAR ?
chawax Mar 12, 2008 6:35 AM (in response to chawax)Thanks for your response. I guess this jboss.xml file works only for JBoss application server ? The problem is that my app has to work on other AS such as IBM Webpshere. Is there a standard solution for this ?
P.S. : I saw you can use annotations with EJB3 but this part of my application is generated from AndroMDA so it's not my own choice ;) -
3. Re: How to retrieve an EJB from a JAR used in many EAR ?
jaikiran Mar 12, 2008 6:46 AM (in response to chawax)"chawax" wrote:
Thanks for your response. I guess this jboss.xml file works only for JBoss application server ? The problem is that my app has to work on other AS such as IBM Webpshere. Is there a standard solution for this ?
Yes the jboss.xml file is JBoss specific. Each server provides it own way to specify jndi-names for EJBs. While porting this application to some other server, you will have to use that application server specific files to specify the jndi-name. -
4. Re: How to retrieve an EJB from a JAR used in many EAR ?
chawax Mar 12, 2008 9:35 AM (in response to chawax)Well, I hope there will be a standard solution for this in next EJB specifications. Do you have an idea how difficult it is to do the same with Webpshere or other application servers ?
-
5. Re: How to retrieve an EJB from a JAR used in many EAR ?
jaikiran Mar 12, 2008 9:45 AM (in response to chawax)"chawax" wrote:
Do you have an idea how difficult it is to do the same with Webpshere or other application servers ?
Instead of jboss.xml file they have their own xml files (for websphere it is ibm-ejb-jar-bnd.xmi). -
6. Re: How to retrieve an EJB from a JAR used in many EAR ?
chawax Mar 12, 2008 9:54 AM (in response to chawax)OK, thanks a lot, you were very helpful.