[jboss-jira] [JBoss JIRA] (JGRP-1702) org.jgroups.blocks.atomic.CounterService.getOrCreateCounter(counterName, -1) causing NullPointerException in EAP6.1.1
Bela Ban (JIRA)
jira-events at lists.jboss.org
Mon Sep 23 06:30:03 EDT 2013
[ https://issues.jboss.org/browse/JGRP-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806371#comment-12806371 ]
Bela Ban commented on JGRP-1702:
--------------------------------
The NPE happens because the channel isn't yet connected at the time the counter is created. However, because a counter is associated with the node's address and the thread ID (the so-called *owner*), and the address is null, the NPE occurs.
I'm going to add code which checks that a channel is connected when creating a counter, and - if not - throw an IllegalStateException.
I know this won't help you, but since you already have a workaround, it should be fine. However, throwing an exception makes it clear that the counter service is used incorrectly (before having connected the channel).
> org.jgroups.blocks.atomic.CounterService.getOrCreateCounter(counterName,-1) causing NullPointerException in EAP6.1.1
> --------------------------------------------------------------------------------------------------------------------
>
> Key: JGRP-1702
> URL: https://issues.jboss.org/browse/JGRP-1702
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 3.2.10
> Environment: JBOSS EAP 6.1.1 on Linux CentOS5
> Reporter: Ramil Israfilov
> Assignee: Bela Ban
> Fix For: 3.4
>
>
> WE were happyly using the counterService.getOrCreateCounter(counter, -1); API in the JBOSS 7.1.3 (JBOSS EAP 6.0.1),
> we tried to migrate to EAP 6.1.1 and got NullPointerException on that call
> Here is the stacktrace:
> Caused by: java.lang.NullPointerException
> at org.jgroups.util.Owner.hashCode(Owner.java:52) [jgroups-3.2.10.Final-
> redhat-2.jar:3.2.10.Final-redhat-2]
> at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:882
> ) [rt.jar:1.6.0_26]
> at org.jgroups.protocols.COUNTER.getOrCreateCounter(COUNTER.java:140) [j
> groups-3.2.10.Final-redhat-2.jar:3.2.10.Final-redhat-2]
> at org.jgroups.blocks.atomic.CounterService.getOrCreateCounter(CounterSe
> rvice.java:34) [jgroups-3.2.10.Final-redhat-2.jar:3.2.10.Final-redhat-2]
> at com.alu.mdm.container.jboss.JBossContainerImpl.getOrCreateDistributed
> Counter(JBossContainerImpl.java:102) [:]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list