7 Replies Latest reply on Oct 30, 2006 7:24 AM by Piotr Lizurek

    javax.naming.NameNotFoundException: ejbtut not bound

    Piotr Lizurek Newbie

      I have an interface statelessTekst.java:

      package src;
      import javax.ejb.Remote;
      public interface statelessTekst {
       public String podajTekst(int numer);

      And a bean statelessTekstBean.java:
      package src;
      import javax.ejb.Stateless;
      import src.statelessTekst;
      public @Stateless class statelessTekstBean implements statelessTekst {
       public String podajTekst(int numer)
       return "Test 1 udany";

      I put this files to the jar file named ejbtut.jar.

      Then I made ear file. I put to this ear file ejbtut.jar file and, to the META-INF folder, a simple application.xml file:
      <?xml version="1.0" encoding="UTF-8"?>
      <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
       xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
       <description>J2EE Made Easy Trail Map</description>

      I put this ejbtut file to the deploy folder and I started jboss server. Everything goes OK.

      Then i wrote simple client application:
      import javax.naming.*;
      import src.statelessTekst;
      import java.util.Hashtable;
      public class calculator
       public static void main(String[] args)
       Hashtable p = new Hashtable();
       p.put(InitialContext.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
       p.put(InitialContext.PROVIDER_URL, "jnp://");
       statelessTekst cal = null;
       try {
       InitialContext ctx = new InitialContext(p);
       cal = (statelessTekst) ctx.lookup(
       } catch (Exception e) {
       e.printStackTrace ();

      Bu, when I start the client application, I get exception:
      javax.naming.NameNotFoundException: ejbtut not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      at java.lang.reflect.Method.invoke(Method.java:585)

      What I am doing wrong?
      Please, help!