3 Replies Latest reply on Jul 12, 2006 5:27 AM by Carlo de Wolf

    NullPointerException in HelloWorld

    Qba C Newbie

      Hi,
      I'am using NetBeans5.5 Beta, and latest JBoss 4.0.4GA Patch1.
      My problem is, when trying to run simple HelloWorld application I have NPE message.
      What do I do wrong or what should I do more?

      here is
      enterprise bean class:

      package hello;
      import javax.ejb.Stateless;
      @Stateless
      public class HelloBean implements hello.HelloRemote {
      public HelloBean() {}
      public String komunikat() {
      return "HelloWorld";
      }
      }

      remote interface:

      package hello;
      import javax.ejb.Remote;
      @Remote
      public interface HelloRemote {
      public String komunikat();
      }

      application client:

      package hellojb;
      import javax.annotation.EJB;
      import hello.HelloRemote;
      public class Main {
      @EJB
      private static HelloRemote bin;
      public Main() {
      }
      public static void main(String[] args) {
      System.out.println("HERE: " + bin.komunikat()); //<----this line makes exception
      }
      }

      log:
      Applicaton Deployed
      Operation start started
      run-deploy:
      run-tool:
      run-jar:
      Exception in thread "main" java.lang.NullPointerException
      at hellojb.Main.main(Main.java:35)
      Java Result: 1
      run-display-browser:
      run:
      BUILD SUCCESSFUL (total time: 1 second)