2 Replies Latest reply on Feb 16, 2006 4:27 PM by Filippo

    EJB-3.0_RC5-PFD tutorial: problem on stateless sample

    Filippo Newbie

      I've succesfully installed JBoss-4.0.4RC1 on windows XP sp2 using graphical installer.
      Now I was experimenting with stateless session bean as explained in the tutorial.

      I'm not able to do the lookup to local interface CalculatorLocal of CalculatorBean on client side.
      What I get is:

      run:
      [java] Exception in thread "main" java.lang.NullPointerException
      [java] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:74)
      [java] at $Proxy0.add(Unknown Source)
      [java] at org.jboss.tutorial.stateless.client.Client.main(Client.java:35)
      [java] Java Result: 1
      BUILD SUCCESSFUL
      Total time: 1 second


      I'm sure about the existence of jndi binding, as reported in Global JNDI Namespace (jmx console, service=JNDIView):

      +- CalculatorBean (class: org.jnp.interfaces.NamingContext)
      | +- local (proxy: $Proxy48 implements interface org.jboss.tutorial.stateless.bean.CalculatorLocal,interface org.jboss.ejb3.JBossProxy)
      | +- remote (proxy: $Proxy47 implements interface org.jboss.tutorial.stateless.bean.CalculatorRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)


      Remote binding works correctly. So I'm struggling only on local interface.

      Server side sources are same of tutorial.
      Client side source has only one line modified (in order to lookup local interface)

      public class Client
      {
      public static void main(String[] args) throws Exception
      {
      InitialContext ctx = new InitialContext();
      Calculator calculator = (Calculator) ctx.lookup("CalculatorBean/local");

      System.out.println("1 + 1 = " + calculator.add(1, 1));
      System.out.println("1 - 1 = " + calculator.subtract(1, 1));
      }
      }



      Any help will be appreciated.
      Thanks in advance.