[jboss-user] [EJB 3.0] - Naming for a stateles in an EAR

jc7442 do-not-reply at jboss.com
Fri Aug 31 10:25:50 EDT 2007


I have an interface. with several implentation developped as stateless session. 
In a session bean according to an algorithm I choose one of the implementation. Each implementation as a name and is deployed in the same ear as the invoker

my code looks like:

  | @Resource SessionContext ctx;
  | 
  | public void myMethod() {
  | if (...) {
  | ctx.lookup("earName/myImpl1/local");
  | } else if (...) {
  | ctx.lookup("earName/myImpl2/local");
  | } ...
  | }
  | 

This code works fine but I have to hardcode the name of the ear. In my project the name of the ear contain the project version. I'd like to be able to do a lookup with adding the earname. My ejb always uses implemtnations contains in the same ear. 

1-Is it possible to invoke a service in the same ear without writting the ear name in the lookup ?
2-Is it possible to dynamiclly get the ear name from a staeless session ?

I do not want to use the EJB annotation in order not to inject ejb that I will not use. Is there other solution ?




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080024#4080024

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080024



More information about the jboss-user mailing list