2 Replies Latest reply on May 9, 2006 5:54 AM by harinath mallepally

    invalid invocation error during ejb client call

    harinath mallepally Newbie

      can you please help me write a healthy working ejb client program for EJB 3.0?


      Here is the exception:


      javax.ejb.EJBException: Invalid invocation of local interface (null container)

      at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:75)

      at $Proxy0.calculate(Unknown Source)

      at client.CalculatorClient.main(CalculatorClient.java:52)


      Here is my program..


      /**
      *
      */
      package client;

      import java.util.Hashtable;

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

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

      /**
      * @author RArvinda
      *
      */
      public class CalculatorClient {


      public static void main(String[] args) throws Exception
      {

      Hashtable env = new Hashtable();

      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099"); env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      try
      {
      Context ctx = new InitialContext(env);
      trail.slsb.Calculator calculator = (trail.slsb.Calculator) ctx.lookup("EJB3Trail/StatelessCalculator/local");
      System.out.println("1 + 1 = " + calculator.calculate(10,10,10.0,10.0));

      }catch(Exception e){
      e.printStackTrace();
      }
      }
      }