[jboss-user] [EJB 3.0] - Programmatically determining ear name for JNDI lookups:

jnorris10 do-not-reply at jboss.com
Thu Sep 13 02:58:10 EDT 2007

When doing JNDI lookups of EJB components (when injection isn't available), I have to lookup by "EAR_NAME/BEAN_IMPL/{local/remote}".  However for some components that are shared in different ears, I don't want to hardcode an ear name.  Is there a way I find the ear name programmatically?

I realize I can use @LocalBinding/@RemoteBinding to change where it is bound to, but I want it to be bound specifically within the context of the ear since this component could also be deployed in a different ear on the same system.  Therefore, representing this context in the JNDI tree by ear name is quite reasonable.  I just need to be able to determine the ear name programmatically.

Currently I resort to putting the ear name in a custom configuration file in the EAR, and looking it up when I need to lookup components.  However this is clumsy because it's duplicating the implicit ear name information.

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

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

More information about the jboss-user mailing list