JBoss Community

How to do global JNDI lookup

created by Viggo Navarsete in JNDI and Naming - View the full discussion

Hi,

given that my global JNDI tree looks like this:

global JNDI Namespace

 

  +- UserTransactionSessionFactory (proxy: $Proxy175 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
  +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
  +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
  +- SecureDeploymentManager (class: org.jnp.interfaces.NamingContext)
  |   +- remote[link -> DeploymentManager] (class: javax.naming.LinkRef)
  +- SecureManagementView (class: org.jnp.interfaces.NamingContext)
  |   +- remote[link -> ManagementView] (class: javax.naming.LinkRef)
  +- DeploymentManager (class: org.jboss.aop.generatedproxies.AOPProxy$4)
  +- mds-ear-1.3.1-SNAPSHOT (class: org.jnp.interfaces.NamingContext)
  |   +- RbacBean (class: org.jnp.interfaces.NamingContext)
  |   |   +- local-com.tracetracker.mds.adm.business.RbacLocal (class: Proxy for: com.tracetracker.mds.adm.business.RbacLocal)
  |   |   +- local (class: Proxy for: com.tracetracker.mds.adm.business.RbacLocal)
  |   +- MasterDataBean (class: org.jnp.interfaces.NamingContext)
  |   |   +- local (class: Proxy for: com.tracetracker.mds.adm.business.MasterDataLocal)
  |   |   +- local-com.tracetracker.mds.adm.business.MasterDataLocal (class: Proxy for: com.tracetracker.mds.adm.business.MasterDataLocal)
  |   +- MasterDataXMLValidatorBean (class: org.jnp.interfaces.NamingContext)
  |   |   +- local (class: Proxy for: com.tracetracker.mds.adm.business.MasterDataXMLValidatorLocal)
  |   |   +- local-com.tracetracker.mds.adm.business.MasterDataXMLValidatorLocal (class: Proxy for: com.tracetracker.mds.adm.business.MasterDataXMLValidatorLocal)
  |   +- MDDValidatorBean (class: org.jnp.interfaces.NamingContext)
  |   |   +- local (class: Proxy for: com.tracetracker.mds.adm.business.MDDValidatorLocal)

 

how do I write code to lookup MasterDataBean in JBoss 6.0.0.Final?

 

The convention is (as far as I know) this:

java:global[/<app-name>]/<module-name>/<bean-name>[!<fully-qualified-interface-name>]

 

which should translate to this code (but doesn't currently work!):

InitialContext ctx = new InitialContext();

Object obj = ctx.lookup( "java:global/mds-ear-1.3.1-SNAPSHOT/MasterDataBean" );

private MasterDataLocal masterDataService = (MasterDataLocal) obj;

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community