3 Replies Latest reply on Oct 13, 2007 12:53 AM by jaikiran pai

    javax.naming.CommunicationException while executing a client

    arvinda rajan Newbie

      hi i am getting the following error

      the exception

      javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ejb.EJBMetaDataImpl (no security manager: RMI class loader disabled)]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at client.CalculatorClient.main(CalculatorClient.java:45)
      Caused by: java.lang.ClassNotFoundException: org.jboss.proxy.ejb.EJBMetaDataImpl (no security manager: RMI class loader disabled)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652)
      ... 3 more
      javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ejb.EJBMetaDataImpl (no security manager: RMI class loader disabled)]


      my client class

      /**
      *
      */
      package client;

      import calc.Calculator;
      //import calc.CalculatorRemote;

      import javax.naming.Context;
      import javax.naming.InitialContext;

      import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;


      public class CalculatorClient {


      public static void main(String[] args) throws Exception
      {
      // Look up home interface

      Hashtable env = new Hashtable();
      //env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");

      ("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      System.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      System.setProperty(Context.PROVIDER_URL, "localhost:1099");
      System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

      try

      {

      /* Context ctx = new InitialContext();
      Calculator calculator = (Calculator) ctx.lookup("leaving/StatelessCalculator/local");
      System.out.println("1 + 1 = " + calculator.add(1, 1));*/


      InitialContext ctx = new InitialContext();
      Calculator calculator = (Calculator) ctx.lookup("leaving/StatelessCalculator/remote");

      System.out.println("1 + 1 = " + calculator.add(1, 1));
      //System.out.println("1 - 1 = " + calculator.subtract(1, 1));
      }catch (Exception e)
      {
      e.printStackTrace();
      System.out.println(e);
      }
      }
      }



      please tell me how do i rectify/modify the program

        • 1. Re: javax.naming.CommunicationException while executing a cl
          jaikiran pai Master

           

          [Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ejb.EJBMetaDataImpl


          The EJBMetaDataImpl is not present in the classpath. Place the appropriate jar(s) in the classpath.



          • 2. Re: javax.naming.CommunicationException while executing a cl
            mahak agarwal Newbie

            Hi i am also facing same problem
            /*
            * CartClient.java
            *
            * Created on October 11, 2007, 10:31 AM
            *
            * To change this template, choose Tools | Template Manager
            * and open the template in the editor.
            */

            package ejb_stateful;

            import java.util.Collection;
            import java.util.Hashtable;
            import java.util.Iterator;
            import javax.naming.Context;
            import javax.naming.InitialContext;
            import javax.naming.NamingException;

            public class CartClient {
            public static void main(String [] args) throws NamingException {

            try {

            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
            env.put(Context.PROVIDER_URL,"localhost");
            env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");

            Context context = new InitialContext(env);

            if(context!=null)
            System.out.println("context: success");

            ejb_stateful.CartRemote cart=null;
            try{
            cart = (ejb_stateful.CartRemote)context.lookup("CartBean");
            }catch(Exception e){
            System.out.println("naming ex here"+e);
            }
            if(cart==null)
            System.out.println("cart is null");
            if(cart!=null)
            System.out.println("cart: success");
            System.out.println("Adding items to cart");

            cart.addItem("Pizza");
            cart.addItem("Pasta");
            cart.addItem("Noodles");
            cart.addItem("Bread");
            cart.addItem("Butter");

            System.out.println("Listing cart contents");
            Collection items = cart.getItems();
            for (Iterator i = items.iterator(); i.hasNext();) {
            String item = (String) i.next();
            System.out.println(" " + item);
            }
            } catch (Exception ex) {
            ex.printStackTrace();
            }
            }


            }

            • 3. Re: javax.naming.CommunicationException while executing a cl
              jaikiran pai Master

              You will have to post the entire exception stacktrace, you are seeing and also provide more details of your application.