4 Replies Latest reply on Jul 8, 2002 12:21 PM by smike_lv

    Problem using local interface

    kenryu

      hi;
      I have a problem in using local interface, Please post me the sample code of how to do it. I noticed there are couple ways of doing this and one of them is configuring the jndi.properties so that you don't need to pass the configuration to the initialContext, can someone post me the jndi.properties file? and should I set the jndi.properties differently is I use remote interface?? Could somebody please answer.



      I have a java class that will test the local bean.
      This is the part of the code for the class that test it:

      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "localhost:1099");
      InitialContext jndiContext = new InitialContext(props);


      System.out.println("looking up the bean");
      Object ref = jndiContext.lookup("ejb/TestLocalHome");
      System.out.println("lookup success!");
      TestLocalHome home = (TestLocalHome) ref;


      on jboss.xml:
      =============

      <enterprise-beans>

      <ejb-name>TestBean</ejb-name>
      <jndi-name>ejb/Test</jndi-name>
      <local-jndi-name>ejb/TestLocalHome</local-jndi-name>

      </enterprise-beans>


      This is the error that I got:
      =============================

      Exception = java.lang.ClassCastException: javax.naming.Reference