2 Replies Latest reply on Jan 19, 2005 7:43 AM by Kuesley Nascimento

    Problem JNDI

    Kuesley Nascimento Newbie

      I was seacher in forum, but i dont have sucess.
      I deploy my EJB, with web application i can to use theses ejb without problems, but when i try acess with desktop application i get the message myCustomerBean not bound.

      Look my files:

      meta-inf/jboss-client.xml

      <jboss-client>
       <jndi-name>myCustomerBean</jndi-name>
       <ejb-ref>
       <ejb-ref-name>CustomerBean</ejb-ref-name>
       <jndi-name>myCustomerBean</jndi-name>
       </ejb-ref>
      </jboss-client>


      jndi.properties
      ava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jboss.naming.client
      j2ee.clientName=myCustomerBean


      My App Test:

      public class TestEJB {
      public static void main(String[] args) {
      try {
      FileInputStream file = new FileInputStream("jndi.properties");
      Properties prop = new Properties();
      prop.load(file);
      Context c = new InitialContext(prop);
      Object homeObject = c.lookup("myCustomerBean");
      }
      catch (Exception e) {
      e.printStackTrace();
      }
      }
      }



      Theses files are in meta-inf the myapp.ear

      ejb-jar.xml
      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
      <ejb-jar
       xmlns="http://java.sun.com/xml/ns/j2ee"
       version="2.1"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
       >
       <display-name xml:lang="pt">JForms Samples EJB</display-name>
      
       <enterprise-beans>
      
       <!-- Customer -->
      
       <entity>
       <ejb-name>CustomerBean</ejb-name>
       <home>org.jforms.samples.ejb.CustomerHome</home>
       <remote>org.jforms.samples.ejb.Customer</remote>
       <ejb-class>org.jforms.samples.ejb.CustomerBean</ejb-class>
       <persistence-type>Bean</persistence-type>
       <prim-key-class>java.lang.String</prim-key-class>
       <reentrant>false</reentrant>
       </entity>
       </enterprise-beans>
       </assembly-descriptor>
      </ejb-jar>


      jboss.xml
      <enterprise-beans>
       <ejb-name>CustomerBean</ejb-name>
       <local-jndi-name>myCustomerBean</local-jndi-name>
      </enterprise-beans>


      But, when i perform, i get: javax.naming.NameNotFoundException: myCustomerBean not bound

      Thanks for any help.