Re: [jgroups-dev] What does cause NullPointerException?

Development issues <[email protected]> Fri, 25 Dec 2015 07:09:52 -0700 (MST)
Newsgroups gmane.comp.java.javagroups.devel
Message-ID <[email protected]>
--===============7066701982808442540==
Content-Type: multipart/alternative; 
	boundary="----=_Part_656819_970410837.1451052592431"

------=_Part_656819_970410837.1451052592431
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<<You didn't send the whole code, so I wasn't able to investigate. I=20
<<suggest debug this yourself by setting a breakpoint in your code... this=
=20
<<is probably the fastest way to find the cause
As I told you I do not use Junit or run the code from IDE. When I make chan=
ge on code, I deploy it to the Linux machines complie and run it using Linu=
x command line. I never run it on IDE becuse I remmber ant does not work in=
 eclipce.
=C2=A0Thank you
Ibrahim=20
=20

    On Friday, December 25, 2015 1:20 PM, JGroups - Dev mailing list [via J=
Groups] <[email protected]> wrote:
=20

  You didn't send the whole code, so I wasn't able to investigate. I=20
suggest debug this yourself by setting a breakpoint in your code... this=20
is probably the fastest way to find the cause

On 25/12/15 13:03, Development issues wrote:
> The exception occurs in your code (Zab2PhasesTest.resetProtocol), so
> without that code I don't know what's going on. If you post a unit test
> and package up the code I could take a look. Or you set a breakpoint in
> Zab2PhasesTest.resetProtocol() and see what's null that triggers the NPE.
>
> Yes, The exception occurs in your code (Zab2PhasesTest.resetProtocol) in
> line channel.send(msg).
> In fact, I do not use Junit test, when I am coding and =C2=A0testing the
> code, I just compile and run it in Linux machines using command line.
> The attachment shows the codes. They are two files, one called
> Zab2PhasesTest and second called Zab2PhasesClient. Zab2PhasesClient uses
> by Zab2PhasesTest to initial senders to send requests to servers.
>
> Note that NPE occurs in Zab2PhasesTest.resetProtocol in line
> channel.send(msg, line 192.
>
> Thank you indeed
>
> Ibrahim
>
>
>
> On Friday, December 25, 2015 7:58 AM, JGroups - Dev mailing list [via
> JGroups] <[hidden email] </user/SendEmail.jtp?type=3Dnode&node=3D10927&i=
=3D0>>
> wrote:
>
>
> The exception occurs in your code (Zab2PhasesTest.resetProtocol), so
> without that code I don't know what's going on. If you post a unit test
> and package up the code I could take a look. Or you set a breakpoint in
> Zab2PhasesTest.resetProtocol() and see what's null that triggers the NPE.
>
> On 24/12/15 22:34, Development issues wrote:
>
> =C2=A0> <<An NPE can only occur if channel is null at this point...
> =C2=A0> <<JChannel.getAddress() can of course return null if the channel =
hasn't
> =C2=A0> <<been connected yet, but you'd only get an NPE if you try to ref=
erence
> =C2=A0> <<local_address
> =C2=A0> The channel is connected and I use it without any problem before =
the
> =C2=A0> line where the exception occur. Meaning that with the same code I=
 manage
> =C2=A0> to use channel to send requests to the servers, but where the exe=
cution
> =C2=A0> come to line channel.send(msg), the exception occurs. This is why=
 I am
> =C2=A0> surprised when I use channel first time it worked but when I use =
it
> =C2=A0> again I have NullPointerException.
> =C2=A0> <<OK. Can you also subscribe properly? So far, I've had to approv=
e
> all of
> =C2=A0> <<your posts individually...
> =C2=A0> I thought I am already subscribe by using and logging in to this =
site
> =C2=A0> http://jgroups.1086181.n5.nabble.com/.
> =C2=A0> No worry, I have found another site and just subscribe today whic=
h is
> =C2=A0> https://sourceforge.net/p/javagroups/mailman/javagroups-developme=
nt/. I
> =C2=A0> hope now I am subscribed correctly.
> =C2=A0> The following is stack trace as requested:
> =C2=A0> java.lang.NullPointerException
> =C2=A0> at
> =C2=A0>
> org.jgroups.protocols.jz.Zab2PhasesTest.resetProtocol(Zab2PhasesTest.java=
:192)
>
> =C2=A0> at
> =C2=A0>
> org.jgroups.protocols.jz.Zab2PhasesTest.finishedSend(Zab2PhasesTest.java:=
318)
>
> =C2=A0> at
> =C2=A0>
> org.jgroups.protocols.jz.Zab2PhasesClient.receive(Zab2PhasesClient.java:1=
43)
>
> =C2=A0> at org.jgroups.JChannel.invokeCallback(JChannel.java:812)
> =C2=A0> at org.jgroups.JChannel.up(JChannel.java:736)
> =C2=A0> at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:1029)
> =C2=A0> at
> org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:146)
> =C2=A0> at org.jgroups.protocols.FRAG2.up(FRAG2.java:165)
> =C2=A0> at
> =C2=A0>
> org.jgroups.protocols.jz.Zab2Phases.handleOrderingResponse(Zab2Phases.jav=
a:588)
>
> =C2=A0> at org.jgroups.protocols.jz.Zab2Phases.up(Zab2Phases.java:256)
> =C2=A0> at org.jgroups.protocols.jz.Zab2Phases.up(Zab2Phases.java:277)
> =C2=A0> at org.jgroups.protocols.RSVP.up(RSVP.java:237)
> =C2=A0> at org.jgroups.stack.Protocol.up(Protocol.java:420)
> =C2=A0> at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:294)
> =C2=A0> at org.jgroups.protocols.UNICAST3.deliverBatch(UNICAST3.java:1087=
)
> =C2=A0> at org.jgroups.protocols.UNICAST3.removeAndDeliver(UNICAST3.java:=
886)
> =C2=A0> at org.jgroups.protocols.UNICAST3.handleDataReceived(UNICAST3.jav=
a:790)
> =C2=A0> at org.jgroups.protocols.UNICAST3.up(UNICAST3.java:426)
> =C2=A0> at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:619)
> =C2=A0> at org.jgroups.protocols.BARRIER.up(BARRIER.java:152)
> =C2=A0> at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:15=
5)
> =C2=A0> at org.jgroups.protocols.FD_ALL.up(FD_ALL.java:200)
> =C2=A0> at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:297)
> =C2=A0> at org.jgroups.protocols.MERGE2.up(MERGE2.java:237)
> =C2=A0> at org.jgroups.protocols.Discovery.up(Discovery.java:277)
> =C2=A0> at org.jgroups.protocols.TP.passMessageUp(TP.java:1572)
> =C2=A0> at org.jgroups.protocols.TP$MyHandler.run(TP.java:1791)
> =C2=A0> at
> =C2=A0>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java=
:1142)
>
> =C2=A0> at
> =C2=A0>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.jav=
a:617)
>

--=20
Bela Ban, JGroups lead (http://www.jgroups.org)


---------------------------------------------------------------------------=
---
_______________________________________________
Javagroups-development mailing list

=20
=20
   If you reply to this email, your message will be added to the discussion=
 below: http://jgroups.1086181.n5.nabble.com/What-does-cause-NullPointerExc=
eption-tp10915p10928.html   To unsubscribe from What does cause NullPointer=
Exception?, click here.
 NAML=20





--
View this message in context: http://jgroups.1086181.n5.nabble.com/What-doe=
s-cause-NullPointerException-tp10915p10929.html
Sent from the JGroups - Dev mailing list archive at Nabble.com.
------=_Part_656819_970410837.1451052592431
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

<div style=3D"color:#000; background-color:#fff; font-family:bookman old st=
yle, new york, times, serif;font-size:16px"><div id=3D"yui_3_16_0_1_1451051=
762788_6019" dir=3D"ltr">&lt;&lt;You didn't send the whole code, so I wasn'=
t able to investigate. I=20
<br class=3D"" id=3D"yui_3_16_0_1_1451051762788_6576">&lt;&lt;suggest debug=
 this yourself by setting a breakpoint in your code... this=20
<br class=3D"" id=3D"yui_3_16_0_1_1451051762788_6578">&lt;&lt;is probably t=
he fastest way to find the cause
</div><div id=3D"yui_3_16_0_1_1451051762788_6574" dir=3D"ltr"><br></div><di=
v id=3D"yui_3_16_0_1_1451051762788_6614" dir=3D"ltr">As I told you I do not=
 use Junit or run the code from IDE. When I make change on code, I deploy i=
t to the Linux machines complie and run it using Linux command line. I neve=
r run it on IDE becuse I remmber ant does not work in eclipce.<br></div><di=
v id=3D"yui_3_16_0_1_1451051762788_6020"><span></span></div><div id=3D"yui_=
3_16_0_1_1451051762788_6022"><div id=3D"yui_3_16_0_1_1451051762788_6637">&n=
bsp;Thank you</div><div id=3D"yui_3_16_0_1_1451051762788_6638"><br></div></=
div><div id=3D"yui_3_16_0_1_1451051762788_6023" class=3D"signature">Ibrahim=
 <br></div> <div id=3D"yui_3_16_0_1_1451051762788_6157" class=3D"qtdSeparat=
eBR"><br><br></div><div style=3D"display: block;" id=3D"yui_3_16_0_1_145105=
1762788_6461" class=3D"yahoo_quoted"> <div id=3D"yui_3_16_0_1_1451051762788=
_6460" style=3D"font-family: bookman old style, new york, times, serif; fon=
t-size: 16px;"> <div id=3D"yui_3_16_0_1_1451051762788_6459" style=3D"font-f=
amily: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans=
-serif; font-size: 16px;"> <div id=3D"yui_3_16_0_1_1451051762788_6458" dir=
=3D"ltr"><font id=3D"yui_3_16_0_1_1451051762788_6457" size=3D"2" face=3D"Ar=
ial"> On Friday, December 25, 2015 1:20 PM, JGroups - Dev mailing list [via=
 JGroups] &lt;<a href=3D"/user/SendEmail.jtp?type=3Dnode&node=3D10929&i=3D0=
" target=3D"_top" rel=3D"nofollow" link=3D"external">[hidden email]</a>&gt;=
 wrote:<br></font></div>  <br><br> <div id=3D"yui_3_16_0_1_1451051762788_65=
18" class=3D"y_msg_container"><div id=3D"yiv7797654117">

=09You didn't send the whole code, so I wasn't able to investigate. I=20
<br>suggest debug this yourself by setting a breakpoint in your code... thi=
s=20
<br>is probably the fastest way to find the cause
<br><br>On 25/12/15 13:03, Development issues wrote:
<div id=3D"yui_3_16_0_1_1451051762788_6559" class=3D"yiv7797654117shrinkabl=
e-quote"><div class=3D'shrinkable-quote'><br>&gt; The exception occurs in y=
our code (Zab2PhasesTest.resetProtocol), so
<br>&gt; without that code I don't know what's going on. If you post a unit=
 test
<br>&gt; and package up the code I could take a look. Or you set a breakpoi=
nt in
<br>&gt; Zab2PhasesTest.resetProtocol() and see what's null that triggers t=
he NPE.
<br>&gt;
<br>&gt; Yes, The exception occurs in your code (Zab2PhasesTest.resetProtoc=
ol) in
<br>&gt; line channel.send(msg).
<br>&gt; In fact, I do not use Junit test, when I am coding and &nbsp;testi=
ng the
<br>&gt; code, I just compile and run it in Linux machines using command li=
ne.
<br>&gt; The attachment shows the codes. They are two files, one called
<br>&gt; Zab2PhasesTest and second called Zab2PhasesClient. Zab2PhasesClien=
t uses
<br>&gt; by Zab2PhasesTest to initial senders to send requests to servers.
<br>&gt;
<br>&gt; Note that NPE occurs in Zab2PhasesTest.resetProtocol in line
<br>&gt; channel.send(msg, line 192.
<br>&gt;
<br>&gt; Thank you indeed
<br>&gt;
<br>&gt; Ibrahim
<br>&gt;
<br>&gt;
<br>&gt;
<br>&gt; On Friday, December 25, 2015 7:58 AM, JGroups - Dev mailing list [=
via
<br>&gt; JGroups] &lt;[hidden email] &lt;/user/SendEmail.jtp?type=3Dnode&am=
p;node=3D10927&amp;i=3D0&gt;&gt;
<br>&gt; wrote:
<br>&gt;
<br>&gt;
<br>&gt; The exception occurs in your code (Zab2PhasesTest.resetProtocol), =
so
<br>&gt; without that code I don't know what's going on. If you post a unit=
 test
<br>&gt; and package up the code I could take a look. Or you set a breakpoi=
nt in
<br>&gt; Zab2PhasesTest.resetProtocol() and see what's null that triggers t=
he NPE.
<br>&gt;
<br>&gt; On 24/12/15 22:34, Development issues wrote:
<br>&gt;
<br>&gt; &nbsp;&gt; &lt;&lt;An NPE can only occur if channel is null at thi=
s point...
<br>&gt; &nbsp;&gt; &lt;&lt;JChannel.getAddress() can of course return null=
 if the channel hasn't
<br>&gt; &nbsp;&gt; &lt;&lt;been connected yet, but you'd only get an NPE i=
f you try to reference
<br>&gt; &nbsp;&gt; &lt;&lt;local_address
<br>&gt; &nbsp;&gt; The channel is connected and I use it without any probl=
em before the
<br>&gt; &nbsp;&gt; line where the exception occur. Meaning that with the s=
ame code I manage
<br>&gt; &nbsp;&gt; to use channel to send requests to the servers, but whe=
re the execution
<br>&gt; &nbsp;&gt; come to line channel.send(msg), the exception occurs. T=
his is why I am
<br>&gt; &nbsp;&gt; surprised when I use channel first time it worked but w=
hen I use it
<br>&gt; &nbsp;&gt; again I have NullPointerException.
<br>&gt; &nbsp;&gt; &lt;&lt;OK. Can you also subscribe properly? So far, I'=
ve had to approve
<br>&gt; all of
<br>&gt; &nbsp;&gt; &lt;&lt;your posts individually...
<br>&gt; &nbsp;&gt; I thought I am already subscribe by using and logging i=
n to this site
<br>&gt; &nbsp;&gt; <a rel=3D"nofollow" target=3D"_blank" href=3D"http://jg=
roups.1086181.n5.nabble.com/" link=3D"external">http://jgroups.1086181.n5.n=
abble.com/</a>.
<br>&gt; &nbsp;&gt; No worry, I have found another site and just subscribe =
today which is
<br>&gt; &nbsp;&gt; <a id=3D"yui_3_16_0_1_1451051762788_6654" rel=3D"nofoll=
ow" target=3D"_blank" href=3D"https://sourceforge.net/p/javagroups/mailman/=
javagroups-development/" link=3D"external">https://sourceforge.net/p/javagr=
oups/mailman/javagroups-development/</a>. I
<br>&gt; &nbsp;&gt; hope now I am subscribed correctly.
<br>&gt; &nbsp;&gt; The following is stack trace as requested:
<br>&gt; &nbsp;&gt; java.lang.NullPointerException
<br>&gt; &nbsp;&gt; at
<br>&gt; &nbsp;&gt;
<br>&gt; org.jgroups.protocols.jz.Zab2PhasesTest.resetProtocol(Zab2PhasesTe=
st.java:192)
<br>&gt;
<br>&gt; &nbsp;&gt; at
<br>&gt; &nbsp;&gt;
<br>&gt; org.jgroups.protocols.jz.Zab2PhasesTest.finishedSend(Zab2PhasesTes=
t.java:318)
<br>&gt;
<br>&gt; &nbsp;&gt; at
<br>&gt; &nbsp;&gt;
<br>&gt; org.jgroups.protocols.jz.Zab2PhasesClient.receive(Zab2PhasesClient=
.java:143)
<br>&gt;
<br>&gt; &nbsp;&gt; at org.jgroups.JChannel.invokeCallback(JChannel.java:81=
2)
<br>&gt; &nbsp;&gt; at org.jgroups.JChannel.up(JChannel.java:736)
<br>&gt; &nbsp;&gt; at org.jgroups.stack.ProtocolStack.up(ProtocolStack.jav=
a:1029)
<br>&gt; &nbsp;&gt; at
<br>&gt; org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java=
:146)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.FRAG2.up(FRAG2.java:165)
<br>&gt; &nbsp;&gt; at
<br>&gt; &nbsp;&gt;
<br>&gt; org.jgroups.protocols.jz.Zab2Phases.handleOrderingResponse(Zab2Pha=
ses.java:588)
<br>&gt;
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.jz.Zab2Phases.up(Zab2Phases.ja=
va:256)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.jz.Zab2Phases.up(Zab2Phases.ja=
va:277)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.RSVP.up(RSVP.java:237)
<br>&gt; &nbsp;&gt; at org.jgroups.stack.Protocol.up(Protocol.java:420)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:2=
94)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.UNICAST3.deliverBatch(UNICAST3=
.java:1087)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.UNICAST3.removeAndDeliver(UNIC=
AST3.java:886)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.UNICAST3.handleDataReceived(UN=
ICAST3.java:790)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.UNICAST3.up(UNICAST3.java:426)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java=
:619)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.BARRIER.up(BARRIER.java:152)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPE=
CT.java:155)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.FD_ALL.up(FD_ALL.java:200)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:297)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.MERGE2.up(MERGE2.java:237)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.Discovery.up(Discovery.java:27=
7)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.TP.passMessageUp(TP.java:1572)
<br>&gt; &nbsp;&gt; at org.jgroups.protocols.TP$MyHandler.run(TP.java:1791)
<br>&gt; &nbsp;&gt; at
<br>&gt; &nbsp;&gt;
<br>&gt; java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecut=
or.java:1142)
<br>&gt;
<br>&gt; &nbsp;&gt; at
<br>&gt; &nbsp;&gt;
<br>&gt; java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecu=
tor.java:617)
<br>&gt;
</div></div><br>--=20
<br>Bela Ban, JGroups lead (<a rel=3D"nofollow" target=3D"_blank" href=3D"h=
ttp://www.jgroups.org/" link=3D"external">http://www.jgroups.org</a>)
<br><br><br>---------------------------------------------------------------=
---------------
<br>_______________________________________________
<br>Javagroups-development mailing list
<br><br>

=09
=09
=09
=09<br>
=09<br>
=09<hr color=3D"#cccccc" noshade=3D"size=3D&quot;1&quot;">
=09<div style=3D"color:#444;font:12px tahoma, geneva, helvetica, arial, san=
s-serif;">
=09=09<div style=3D"font-weight:bold;">If you reply to this email, your mes=
sage will be added to the discussion below:</div>
=09=09<a rel=3D"nofollow" target=3D"_blank" href=3D"http://jgroups.1086181.=
n5.nabble.com/What-does-cause-NullPointerException-tp10915p10928.html" link=
=3D"external">http://jgroups.1086181.n5.nabble.com/What-does-cause-NullPoin=
terException-tp10915p10928.html</a>
=09</div>
=09<div id=3D"yui_3_16_0_1_1451051762788_6655" style=3D"color:#666;font:11p=
x tahoma, geneva, helvetica, arial, sans-serif;margin-top:.4em;line-height:=
1.5em;">
=09=09
=09=09To unsubscribe from What does cause NullPointerException?, <a rel=3D"=
nofollow" target=3D"_blank" href=3D"" link=3D"external">click here</a>.<br>
=09=09<a rel=3D"nofollow" target=3D"_blank" href=3D"http://jgroups.1086181.=
n5.nabble.com/template/NamlServlet.jtp?macro=3Dmacro_viewer&amp;id=3Dinstan=
t_html%21nabble%3Aemail.naml&amp;base=3Dnabble.naml.namespaces.BasicNamespa=
ce-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNa=
mespace&amp;breadcrumbs=3Dnotify_subscribers%21nabble%3Aemail.naml-instant_=
emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" styl=
e=3D"font:9px serif;" link=3D"external">NAML</a>
=09</div></div><br><br></div>  </div> </div>  </div></div>

=09
=09
=09
<br/><hr align=3D"left" width=3D"300" />
View this message in context: <a href=3D"http://jgroups.1086181.n5.nabble.c=
om/What-does-cause-NullPointerException-tp10915p10929.html">Re: What does c=
ause NullPointerException?</a><br/>
Sent from the <a href=3D"http://jgroups.1086181.n5.nabble.com/JGroups-Dev-f=
6604.html">JGroups - Dev mailing list archive</a> at Nabble.com.<br/>
------=_Part_656819_970410837.1451052592431--


--===============7066701982808442540==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------

--===============7066701982808442540==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Javagroups-development mailing list


--===============7066701982808442540==--