0 Replies Latest reply on Jan 18, 2006 2:49 PM by Jeffrey Goetsch

    StatefulEvictionPolicy.evict - NullPointer

    Jeffrey Goetsch Newbie

      I have created a simple ejb that counts as a Stateful Session Bean. The Bean is being clustered between two boxes. The server is "all" which was created when you install 4.0.3SP1 from the jnlp. We changed the "all" to have a different multicast port and farm deploy.

      Everything works fine until I update the code and redeploy without stopping and starting jboss. Once we redeploy, I start getting this message repeated every ~1 seconds:

      11:20:17,679 INFO [STDOUT] java.lang.NullPointerException
      11:20:17,679 INFO [STDOUT] at org.jboss.ejb3.cache.tree.StatefulEvictionPolicy.evict(StatefulEvictionPolicy.java:33)
      11:20:17,679 INFO [STDOUT] at org.jboss.cache.eviction.LRUAlgorithm.evictCacheNode(LRUAlgorithm.java:196)
      11:20:17,679 INFO [STDOUT] at org.jboss.cache.eviction.LRUAlgorithm.prune(LRUAlgorithm.java:271)

      11:20:17,679 INFO [STDOUT] at org.jboss.cache.eviction.LRUAlgorithm.process(LRUAlgorithm.java:54)
      11:20:17,679 INFO [STDOUT] at org.jboss.cache.eviction.EvictionTimerTask.run(EvictionTimerTask.java:37)
      11:20:17,679 INFO [STDOUT] at java.util.TimerThread.mainLoop(Timer.java:512)
      11:20:17,679 INFO [STDOUT] at java.util.TimerThread.run(Timer.java:462)


      I have included all the code below.

      Receiver.java
      package agms.ejb3;
      
      import javax.ejb.Remote;
      
      @Remote
      public interface Receiver {
      
       public int increment(int byValue);
      
       public void show(String message);
      
      }


      ReceiverBean.java
      package agms.ejb3;
      
      import org.jboss.annotation.ejb.Clustered;
      
      import javax.ejb.*;
      import java.io.Serializable;
      
      @Stateful
      @Clustered
      public class ReceiverBean implements Receiver, Serializable {
      
       private int count;
      
      
       public int increment(int byValue) {
       count += byValue;
       return count;
       }
      
       public void show(String message) {
       System.out.println(message);
       }
      }
      


      The remote connecting code was compiled off of the same .class files that were deployed. To run the code I have included these jars in the classpath:
      jboss-4.0.3SP1\client\jbossall-client.jar
      jboss-4.0.3SP1\server\all\deploy\ejb3.deployer\jboss-ejb3.jar
      jboss-4.0.3SP1\server\all\deploy\ejb3.deployer\jboss-ejb3x.jar
      jboss-4.0.3SP1\server\all\deploy\jboss-aop.deployer\jboss-aspect-library-jdk50.jar

      Sender.java
      package agms.sender;
      
      import agms.ejb3.Receiver;
      
      import javax.naming.InitialContext;
      
      public class Sender {
       SecurityManager security = System.getSecurityManager();
      
       static public void main(String[] args) {
       try {
      
       InitialContext ctx = new InitialContext();
       Receiver r = (Receiver) ctx.lookup(
       Receiver.class.getName());
      
       long time = System.currentTimeMillis();
       int value = r.increment(1);
       while (value < 10000) {
       value = r.increment(1);
       }
      
       String message = "Total time = " + (System.currentTimeMillis() - time);
       System.out.println(message);
       r.show(message);
      
       } catch (Exception e) {
       e.printStackTrace ();
       }
       }
      }