0 Replies Latest reply on Oct 11, 2003 2:17 PM by sajgoc

    cannot bind JNDI name

    sajgoc

       

      "sajgoc" wrote:
      "sajgoc" wrote:
      Hi,
      I am trying to get the CartEJB in Sun's J2ee tutorial run on JBoss
      I have packed the bean classes under cart package and CartClient class
      under client package .Then I set classpath to a jndi.properties file also as given in JBoss3.2 workbook 3rd edition.
      I have set a target in build.xml as below
      <target name="run.client" depends="ejbjar">
      <java classname="client.CartClient" fork="yes" dir=".">
      <classpath refid="myclasspath"/>
      </java>
      </target>

      where myclasspath is
      <path id="myclasspath">
      <fileset dir="${jboss.home}/client">
      <include name="**/*.jar"/>
      </fileset>
      <pathelement location="${build.classes.dir}"/>
      <!-- So that we can get jndi.properties for InitialContext -->
      <pathelement location="${basedir}/jndi"/>
      </path>



      in CartClient's main() I do a lookup as below

      Context jndiContext = getInitialContext();

      Object objref =jndiContext.lookup("MyCart");

      CartHome home =
      (CartHome)PortableRemoteObject.narrow(objref,
      CartHome.class);

      where
      getInitialContext(){
      return new InitialContext();
      }
      my jndi.properties in classpath says

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=localhost

      and in my jboss.xml I bind

      <session>
      <ejb-name>CartEJB</ejb-name>
      <jndi-name>MyCart</jndi-name>
      </session>


      Still when i try to run the client by invoking the target in build.xml
      I get
      javax.naming.NameNotFoundException:MyCart not bound

      Any idea why this happens?am i missing something?I am running jboss on Win98..how do I get this bound properly?
      Please help

      S.J