[ https://issues.apache.org/jira/browse/CASSANDRA-1639?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Ellis resolved CASSANDRA-1639. --------------------------------------- Resolution: Fixed looks like this is fixed in the latest nightly -- should not be possible for getLiveNodes to pass a null list to stringify. > NPE in StorageService when cluster is first being created > --------------------------------------------------------- > > Key: CASSANDRA-1639 > URL: https://issues.apache.org/jira/browse/CASSANDRA-1639 > Project: Cassandra > Issue Type: Bug > Components: Tools > Affects Versions: 0.7 beta 2 > Environment: Windows XP > Reporter: Dave Woldrich > Priority: Minor > Fix For: 0.7.0 > > > Saw this exception on the 0.7.0-beta2 version of cassandra right after > bringing up a cluster and trying to get the number of live nodes. > java.lang.NullPointerException > at > org.apache.cassandra.service.StorageService.stringify(StorageService.java:1151) > at > org.apache.cassandra.service.StorageService.getLiveNodes(StorageService.java:1138) > at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93) > at > com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27) > at > com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208) > at > com.sun.jmx.mbeanserver.PerInterface.getAttribute(PerInterface.java:65) > at > com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(MBeanSupport.java:216) > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:666) > at > com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:638) > at > javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1404) > at > javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72) > at > javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265) > at > javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360) > at > javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:600) > at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305) > at sun.rmi.transport.Transport$1.run(Transport.java:159) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Transport.java:155) > at > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:619) > I fixed this by adding some null checks to the stringify methods > private Set<String> stringify(Collection<InetAddress> endpoints) > { > Set<String> stringEndpoints = new HashSet<String>(); > for (InetAddress ep : endpoints) > { > if(ep != null) { > stringEndpoints.add(ep.getHostAddress()); > } > } > return stringEndpoints; > } > private List<String> stringify(List<InetAddress> endpoints) > { > List<String> stringEndpoints = new ArrayList<String>(); > for (InetAddress ep : endpoints) > { > if(ep != null) { > stringEndpoints.add(ep.getHostAddress()); > } > } > return stringEndpoints; > } > After adding those checks, then I got more reasonable/realistic errors from a > different part of the code since the service wasn't up yet as the cluster was > still initializing: > Caused by: javax.management.InstanceNotFoundException: > org.apache.cassandra.service:type=StorageService > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094) > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:662) > at > com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:638) > at > javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1404) > at > javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72) > at > javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265) > at > javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360) > at > javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:600) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305) > at sun.rmi.transport.Transport$1.run(Transport.java:159) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Transport.java:155) > at > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:619) > at > sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) > at > sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) > at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) > at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) > at > javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown > Source) > at > javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:878) > at > javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:263) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.