-
-
2. Re: How to set JNDI path name?
xerces8 Jan 25, 2010 12:08 PM (in response to jaikiran)Thanks, but I am looking for something to set the prefix.
The beans are deployed in an EAR (foo.ear) and the beans get a jndi name like
foo/ThisBean/remote , foo/ThatBean/remote , foo/OtherBean/remote, ...
JBoss takes the EAR name as the prefix for jndi names. Can that be overridden with some setting (single setting, not one change per each bean).
-
3. Re: How to set JNDI path name?
ralph_ Jan 31, 2010 8:27 PM (in response to xerces8)In EJB3 you may set a global JNDI name using the field "mappedName" in @Stateless and @Stateful:
@Stateless(mappedName="bar/SomeThing/remote")
public class ThisBean implements ThisBeanInterface { ... }
Hope this helps.
-
-
5. Re: How to set JNDI path name?
xerces8 Feb 1, 2010 9:25 AM (in response to xerces8)I found that I can set this in the ./.settings/org.eclipse.wst.common.component file.
There is a XML tag:
<wb-module deploy-name="enter here the name">
And that name will become the JNDI prefix.
-
6. Re: How to set JNDI path name?
jaikiran Feb 1, 2010 9:36 AM (in response to xerces8)1 of 1 people found this helpfulxerces8 wrote:
JBoss takes the EAR name as the prefix for jndi names. Can that be overridden with some setting (single setting, not one change per each bean).
In theory, that's possible (atleast for JBoss AS-5.x and later). Internally by default, we use http://anonsvn.jboss.org/repos/jbossas/projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java which is an implementation of this interface http://anonsvn.jboss.org/repos/jbossas/projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java. You could then write your own custom implementation of this interface and then apply it to all beans in a EJB deployment, by adding the top-level <jndi-binding-policy> in jboss.xml:
<jboss> ... <jndi-binding-policy>org.myapp.mycustomjndibindingpolicy</jndi-binding-policy> ... </jboss>
The practical problem is - there was a bug which did not apply this top-level custom jndi policy to all beans in a deployment, unless you explicitly set it on each bean. This bug has been recently fixed and isn't available in AS-5.1.0 https://jira.jboss.org/jira/browse/JBMETA-232
-
7. Re: How to set JNDI path name?
jaikiran Feb 1, 2010 9:39 AM (in response to xerces8)xerces8 wrote:
I found that I can set this in the ./.settings/org.eclipse.wst.common.component file.
There is a XML tag:
<wb-module deploy-name="enter here the name">
And that name will become the JNDI prefix.
I don't know what that file is. It looks like some Eclipse settings file and is not related to JBoss specific configuration. It perhaps just creates a .ear/.jar with the prefix you mention in there. But remember that, you will run into problems if your application is built outside of Eclipse (maybe through some other IDE or some other build tool).
-
8. Re: How to set JNDI path name?
xerces8 Feb 1, 2010 9:52 AM (in response to jaikiran)yes, it is eclipse specific and does something like you said (.ear name...).
It suits my needs.