save up to 40%

How does the JNDI locate the home interface of an enterprise bean?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

How does the JNDI locate the home interface of an enterprise bean?

Rating:

To locate the home interface of an enterprise bean, the JNDI requires the following steps:

  1. Create the JNDI naming context using the InitialContext class as follows:

    Context ctx = new InitialContext()


  2. Use the InitialContext reference to look up for the JNDI name as follows:

    Object obj = ctx.lookup("JNDIName")

    Here, JNDIName is the JNDI name that is specified at the time of deployment of the enterprise bean.

  3. Narrow the Object to the bean's home interface type using the PortableRemoteObject.narrow method. This method takes two parameters, namely the object returned by the lookup() method and the home interface's class file name, as follows:

    HomeInterfaceType h = (HomeInterfaceType)PortableRemoteObject.narrow(obj, HomeInterfaceType.class)


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.