JPPF Issue Tracker
star_faded.png
Please log in to bookmark issues
bug_report_small.png
CLOSED  Bug report JPPF-354  -  NPE in the node notification forwarding mechanism
Posted Dec 17, 2014 - updated Aug 15, 2018
icon_info.png This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Bug report
  • Status
     
    Closed
  • Assigned to
     lolo4j
  • Progress
       
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
     lolo4j
  • Owned by
    Not owned by anyone
  • Category
    Server
  • Resolution
    RESOLVED
  • Priority
    Normal
  • Reproducability
    Always
  • Severity
    Normal
  • Targetted for
    icon_milestones.png JPPF 4.2.x
Issue description
Trying to listen to notifications from the node, from a driver startup class, I get the followuing exception:
2014-12-17 06:56:33,384 [ERROR][main                ][test.startup.MyDriverStartup.run(65)]: Failed to register MBean listener
javax.management.RuntimeMBeanException: java.lang.NullPointerException
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:839)
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrowMaybeMBeanException(DefaultMBeanServerInterceptor.java:852)
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:821)
  at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
  at org.jppf.management.JMXConnectionWrapper.invoke(JMXConnectionWrapper.java:240)
  at org.jppf.management.JMXDriverConnectionWrapper.registerForwardingNotificationListener(JMXDriverConnectionWrapper.java:298)
  at test.startup.MyDriverStartup.run(MyDriverStartup.java:63)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jppf.utils.hooks.HookInstance.invoke(HookInstance.java:79)
  at org.jppf.utils.hooks.Hook.invoke(Hook.java:133)
  at org.jppf.server.JPPFDriver.run(JPPFDriver.java:169)
  at org.jppf.server.JPPFDriver.main(JPPFDriver.java:348)
Caused by: java.lang.NullPointerException
  at org.jppf.management.NodeSelectionHelper.getChannels(NodeSelectionHelper.java:81)
  at org.jppf.management.forwarding.ForwardingNotificationManager.addNotificationListener(ForwardingNotificationManager.java:104)
  at org.jppf.management.forwarding.ForwardingNotificationManager.addNotificationListener(ForwardingNotificationManager.java:94)
  at org.jppf.management.forwarding.JPPFNodeForwarding.registerForwardingNotificationListener(JPPFNodeForwarding.java:258)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
  at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
  at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
  at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
  at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
  at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
  ... 12 more
Steps to reproduce this issue
Use the following driver startup class and configure it in the driver:
public class MyDriverStartup implements JPPFDriverStartupSPI {
  static Logger log = LoggerFactory.getLogger(MyDriverStartup.class);
  private JMXDriverConnectionWrapper driverJmx;
  private String listenerID;
 
  @Override
  public void run() {
    driverJmx = new JMXDriverConnectionWrapper();
    driverJmx.connect();
    final NodeSelector selector = NodeSelector.ALL_NODES;
    final NotificationListener listener = new NotificationListener() {
      @Override
      public void handleNotification(Notification notification, Object handback) {
        String s = String.format("********** handleNotification: %s handback=%s%n", notification, handback);
        log.info(s);
        System.out.print(s);
      }
    };
    try {
      listenerID = driverJmx.registerForwardingNotificationListener(selector, JPPFNodeTaskMonitorMBean.MBEAN_NAME, listener, null, null);
    } catch (Exception e) {
      log.error("Failed to register MBean listener", e);
    }
  }
}

#3
Comment posted by
 lolo4j
Dec 17, 08:35
The NPE was caused by a wrong initialization order of the driver components upon driver startup. After fixing that, I now get the following exception, when a new node connects to the server:
2014-12-17 07:25:54,612 [DEBUG][x@192.168.1.24:12001][org.jppf.management.forwarding.ForwardingNotificationDispatcher.addNotificationListener(113)]: Waiting response timeout: 9223372036854775807
java.io.InterruptedIOException: Waiting response timeout: 9223372036854775807
  at com.sun.jmx.remote.generic.ClientSynchroMessageConnectionImpl.sendWithReturn(ClientSynchroMessageConnectionImpl.java:329)
  at javax.management.remote.generic.AbstractClientIntermediary.mBeanServerRequest(AbstractClientIntermediary.java:249)
  at javax.management.remote.generic.AbstractClientIntermediary.addListenerWithSubject(AbstractClientIntermediary.java:97)
  at javax.management.remote.generic.AbstractClientIntermediary.addNotificationListener(AbstractClientIntermediary.java:76)
  at javax.management.remote.generic.RemoteMBeanServerConnection.addNotificationListener(RemoteMBeanServerConnection.java:200)
  at org.jppf.management.JMXConnectionWrapper.addNotificationListener(JMXConnectionWrapper.java:416)
  at org.jppf.management.forwarding.ForwardingNotificationDispatcher.addNotificationListener(ForwardingNotificationDispatcher.java:107)
  at org.jppf.management.forwarding.ForwardingNotificationManager.addNotificationListener(ForwardingNotificationManager.java:127)
  at org.jppf.management.forwarding.ForwardingNotificationManager.nodeConnected(ForwardingNotificationManager.java:208)
  at org.jppf.server.event.NodeConnectionEventHandler.fireNodeConnected(NodeConnectionEventHandler.java:76)
  at org.jppf.server.nio.nodeserver.NodeNioServer.nodeConnected(NodeNioServer.java:508)
  at org.jppf.server.nio.nodeserver.AbstractNodeContext$2.jmxWrapperConnected(AbstractNodeContext.java:411)
  at org.jppf.management.JMXConnectionWrapper.fireConnected(JMXConnectionWrapper.java:507)
  at org.jppf.management.JMXConnectionWrapper.performConnection(JMXConnectionWrapper.java:210)
  at org.jppf.management.JMXConnectionThread.run(JMXConnectionThread.java:64)
  at java.lang.Thread.run(Thread.java:744)
#4
Comment posted by
 lolo4j
Dec 19, 20:37
fixed in: