0 Replies Latest reply on Oct 14, 2008 9:46 AM by guna sekaran

    Creation of InitialContext fails when i hot-deploy scheduler

    guna sekaran Newbie

      Creation of InitialContext fails when i hot-deploy scheduler-service.xml

      I configured scheduler-service as follows in Jboss 3.2:

      scheduler-service.xml


      true
      com.beta.my.utils.FMScheduler
      Schedulabe Test,12345
      java.lang.String,int
      0
      10000
      -1


      Schedulable Class

      package com.beta.my.utils;
      import java.util.Date;
      import org.jboss.varia.scheduler.Schedulable;

      public static class FMScheduler
      implements Schedulable
      {
      private String mName;
      private int mValue;

      public FMScheduler(String pName,int pValue)
      {
      mName = pName;
      mValue = pValue;

      }

      public void perform(Date pTimeOfCall,long pRemainingRepetitions)
      {
      try {
      Context context = new InitialContext();//properties taken from jndi.properties file
      } catch (Exception e){
      e.printStackTrace();
      }

      }
      }

      I started my jboss..,FMScheduler created successfully, perform method in FMScheduler called succesfully after SchedulePeriod(1000)
      The problem occurs(NullPointerException) while i changed SchedulePeriod time and hot-deployed(just saved scheduler-service.xml).
      The following Exception occures due to new InitialContext creation in FMScheduler.

      17:46:27,361 ERROR [STDERR] java.lang.NullPointerException
      17:46:27,361 ERROR [STDERR] at org.jboss.mx.loading.UnifiedClassLoader.findR
      esources(UnifiedClassLoader.java:374)
      17:46:27,361 ERROR [STDERR] at java.lang.ClassLoader.getResources(ClassLoade
      r.java:825)
      17:46:27,361 ERROR [STDERR] at com.sun.naming.internal.VersionHelper12$5.run
      (VersionHelper12.java:145)
      17:46:27,361 ERROR [STDERR] at java.security.AccessController.doPrivileged(N
      ative Method)
      17:46:27,377 ERROR [STDERR] at com.sun.naming.internal.VersionHelper12.getRe
      sources(VersionHelper12.java:142)
      17:46:27,377 ERROR [STDERR] at com.sun.naming.internal.ResourceManager.getAp
      plicationResources(ResourceManager.java:468)
      17:46:27,377 ERROR [STDERR] at com.sun.naming.internal.ResourceManager.getIn
      itialEnvironment(ResourceManager.java:159)
      17:46:27,377 ERROR [STDERR] at javax.naming.InitialContext.init(InitialConte
      xt.java:215)
      17:46:27,377 ERROR [STDERR] at javax.naming.InitialContext.(InitialCon
      text.java:195)
      17:46:27,377 ERROR [STDERR] at com.beta.my.utils.FMScheduler.perform
      (FMScheduler.java:42)
      17:46:27,392 ERROR [STDERR] at org.jboss.varia.scheduler.Scheduler$Listener.
      handleNotification(Scheduler.java:1263)
      17:46:27,392 ERROR [STDERR] at org.jboss.mx.server.NotificationListenerProxy
      .handleNotification(NotificationListenerProxy.java:69)
      17:46:27,392 ERROR [STDERR] at javax.management.NotificationBroadcasterSuppo
      rt.sendNotification(NotificationBroadcasterSupport.java:95)
      17:46:27,392 ERROR [STDERR] at javax.management.timer.Timer.sendNotification
      s(Timer.java:441)
      17:46:27,392 ERROR [STDERR] at javax.management.timer.Timer.access$000(Timer
      .java:31)
      17:46:27,408 ERROR [STDERR] at javax.management.timer.Timer$RegisteredNotifi
      cation.doRun(Timer.java:612)
      17:46:27,408 ERROR [STDERR] at org.jboss.mx.util.SchedulableRunnable.run(Sch
      edulableRunnable.java:164)
      17:46:27,408 ERROR [STDERR] at org.jboss.mx.util.ThreadPool$Worker.run(Threa
      dPool.java:225)