3 Replies Latest reply on Sep 18, 2002 9:13 PM by gzbaallee

    local problem

    gzbaallee

      I really don't know what's wrong in it,help me please.

      this is the output:
      Got context
      test
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy0.create(Unknown Source)
      at examples.HelloClient.main(HelloClient.java:49)

      this is the client program
      public class HelloClient {
      public static void main(String[] args)
      {
      String temp="test";
      Object ref;
      // Set up the naming provider; this may not always be necessary, depending
      // on how your Java system is configured.

      System.setProperty("java.naming.factory.initial",
      "org.jnp.interfaces.NamingContextFactory");
      System.setProperty("java.naming.provider.url",
      "localhost:1099");

      // Enclosing the whole process in a single `try' block is not an ideal way
      // to do exception handling, but I don't want to clutter the program up
      // with catch blocks
      try
      {
      // Get a naming context
      InitialContext jndiContext = new InitialContext();
      System.out.println("Got context");
      // Get a reference to the Interest Bean

      HelloLocalHome home=(HelloLocalHome)jndiContext.lookup("local/Hello");

      // Create an Interest object from the Home interface
      HelloLocal h = home.create();
      temp=h.hello();

      // call the calculateCompoundInterest() method to do the calculation

      }
      catch(Exception e)
      {
      e.printStackTrace();
      }
      System.out.println(temp);
      }

      }