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)
      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)

      The following exception is thrown:

      Id : 1 Count : 1 Teacher : Teacher 1

      Can anybody solve the problem for me?



        • 1. Re: client for JAWS example
          Kevin Duffey Newbie

          The only thing I can think of is your call to detail.getLesson(). The getLesson() must be returning NULL and your trying to call a method on the getLesson() that is null, thus your NPE. However, it is possible that the getSubject() call returns null too. Not sure. Do an if() check on it before printing it out to find out which one is null. Then go from there.

          • 2. Re: client for JAWS example
            Barry Pan Newbie

            Hi Buckman:

            Is that data mapping problem? Because I can find the field (Lesson) in database, but when retrieve it, the field (Lesson) is null.


            Barry Pan