[jboss-user] [Microcontainer] - Programmatically getting JNDI Context

amit.bhayani@jboss.com do-not-reply at jboss.com
Mon Nov 3 00:12:06 EST 2008


I have a app which is on MBeans as of now. I am trying to port to MC. One of the requirements I have is one of the MBeans creates POJO's and register with JNDI as and when required. In MC I was thinking this can be replaced by a Factory that gives new instance of POJO bean when 'newInsatnce' is called. However the requirement is such that it should get registered with JNDI for latter look-up. This app should be flexible to be deployed in JBoss AS and hence use JBoss JNDI or standalone and hence use MockInitialContextFactory.

I have seen JndiDecoratedTestCase and it registers the beans to JNDI, but JNDI name is predefined here. While in my app the JNDI name is calculated at runtime. I am wondering how can this be achieved?

Can I get access to JNDI Contex programmatically which has INITIAL_CONTEXT_FACTORY set to MockInitialContextFactory in standalone and set to JBoss context in JBoss environment? This way I can  use factory to get bean and then code in MBean for JNDI registration.


Thanks in advance.



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

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



More information about the jboss-user mailing list