2 Replies Latest reply on Sep 5, 2001 11:01 AM by Barry Pan

    client for JAWS example

    Barry Pan Newbie

      Hi all:

      I use JBoss 2.4.0 with Tomcat 3.2.3, Oracle 8.1. I test the jaws example ( the Class with Lesson example which I download from JBoss), but this example without client code. I have writen my own client code,
      upload code works fine, but retrieve code doesn't work.
      the lesson field in Class object is point to null.

      This is client code :

      public class List
      {

      public static void main(String[] args)
      {
      try
      {
      InitialContext jndiContext = new InitialContext();
      Object ref = jndiContext.lookup("jaws/Class");
      ClassHome home = (ClassHome)
      PortableRemoteObject.narrow (ref, ClassHome.class);

      Collection all = home.findAll();
      Class[] classes = (Class[])all.toArray(new Class[0]);

      for (int i = 0; i < classes.length; i ++ ) {
      ClassDetail detail = classes.getDetail();

      System.out.print("Id : " + detail.getClassId());
      System.out.print(" Count : " + detail.getStudentCount());
      System.out.println(" Teacher : " + detail.getTeacherName());
      System.out.print(" Lesson Subject : " + (detail.getLesson()).getSubject());
      System.out.println(" Lesson Hours : " + (detail.getLesson()).getHours());

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

      The following exception is thrown:

      Id : 1 Count : 1 Teacher : Teacher 1
      java.lang.NullPointerException

      Can anybody solve the problem for me?

      Thanks

      Barry