3 Replies Latest reply on Jun 27, 2013 11:59 AM by Wolf-Dieter Fink

    Hi, all, i meet a strange problem.

    Terry Ma Newbie

      when i run the following test, it does not work and throw an exception "No EJB receiver available for handling". the service is a remote interface running in jboss 7.1.1Final

       

      private  class MyTimerTask extends TimerTask {

              DataPersistenceService ds;

       

       

              public MyTimerTask(DataPersistenceService ds) {

                  this.ds = ds;

              }

       

       

              /*

               * (non-Javadoc)

               * @see org.jboss.netty.util.TimerTask#run(org.jboss.netty.util.Timeout)

               */

              @Override

              public void run() {

                  while (true) {

                      try {

                          List<JobPackPropertyInfo> a = ds.getAllJPProperty();

                          for (JobPackPropertyInfo jobPackPropertyInfo : a) {

                              System.out.println(a);

                          }

                      } catch (SFServiceException e) {

                          // TODO Auto-generated catch block

                          e.printStackTrace();

                      }

                  }

              }

       

       

          }

       

       

          @Test

          public void timer() {

              Thread t = new Thread(new MyTimerTask(service));

              t.start();

          }

       

       

       

      but, when i run the other test method, it works, please see the following codes. what is difference between the two test method?

      @Test

          public void test() throws SFServiceException {

              List<JobPackPropertyInfo> a = service.getAllJPProperty();

              for (JobPackPropertyInfo jobPackPropertyInfo : a) {

                  System.out.println(jobPackPropertyInfo);

              }

          }