nurahmandani / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

NullPointerException on second XMPPConnection.connect() attempt #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi all,

I get a NullPointerException as I try to reconnect to my xmpp server.
I disconnect during the call to onPause and reconnect in onResume

I can connect and login successfully during the first attempt while I get a
NullPointerException at the second.
Here is an excerpt from my code:

public void login(String username, String password,String resource, String
serviceName) throws RemoteException {

if (c == null || !c.isConnected()) {
    c = new XMPPConnection(serviceName);
    try {
    c.connect();
        ....

And this is what comes from the logcat:
java.lang.NullPointerException
org.jivesoftware.smackx.muc.MultiUserChat$1.connectionCreated(MultiUserChat.java
:114)
at
org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:618)
at
org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.j
ava:565)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:991)
at nl.func.fml.service.XMPPServiceImpl$1.login(XMPPServiceImpl.java:73)

The problem occurs with any version of asmack (even with the latest one)

Original issue reported on code.google.com by angelo69...@libero.it on 11 May 2010 at 12:55

GoogleCodeExporter commented 9 years ago
Hi,

I've got an idea/theory whats happening.

You initialize the MultiUserChat after the first connect? That would avaid
MultiUserChat$1.connectionCreated on the first login.

It looks like MultiUserChat depends on ServiceDiscovery, and especially on 
<cinit> of
ServiceDiscovery running before <cinit> of MulitUserChat. That's a horrible 
situation.

I'll see what I can do, but it will require an asmack patch and an upstream bug 
report.

Regards,
  Rene

Original comment by rtreffer@gmail.com on 12 May 2010 at 6:42

GoogleCodeExporter commented 9 years ago
Yes, you're right, this is exactly my situation.
Thanks a lot for your prompt reply.
Hope it will be working soon.
Greetings,
Angelo

Original comment by angelo69...@libero.it on 12 May 2010 at 8:13

GoogleCodeExporter commented 9 years ago
reported upstream as http://www.igniterealtime.org/issues/browse/SMACK-315 - 
I'm now
at a barcamp, so I wont be able to invest much time....

Original comment by rtreffer@gmail.com on 12 May 2010 at 12:37

GoogleCodeExporter commented 9 years ago
Could you try 
http://code.google.com/p/asmack/downloads/detail?name=asmack-issue-13.jar

It's an experimental build with
http://github.com/rtreffer/asmack/commit/3dcf8608c67dd1af509fda69482e131d6bc790b
7

Thanks in advance

Original comment by rtreffer@gmail.com on 15 May 2010 at 10:06

GoogleCodeExporter commented 9 years ago
I meant this commit
http://github.com/rtreffer/smack/commit/7ad98dc7f729781b442156561f5ebc2894569d1b

Original comment by rtreffer@gmail.com on 16 May 2010 at 12:08

GoogleCodeExporter commented 9 years ago
I've seen 7 downloads but no comments. Can anyone comment on this patch? Does it
solve the problem?

Original comment by rtreffer@gmail.com on 17 May 2010 at 12:10

GoogleCodeExporter commented 9 years ago
Hi, thanks for the quickness you worked on this problem.
I've been off in these days, and will be back to work in a week, as soon as i 
try it i'll leave a comment...
Apparently somebody else might have needed it.
Regards,
Angelo

Original comment by angelo69...@libero.it on 17 May 2010 at 2:16

GoogleCodeExporter commented 9 years ago
Hi, I just got back to work, tried that patch and it seems to work perfectly; at
least what comes to my problem, it has been solved.
Thanks a lot.
Greetings,
Angelo

Original comment by angelo69...@libero.it on 25 May 2010 at 8:09

GoogleCodeExporter commented 9 years ago
Thanks for testing.

Original comment by rtreffer@gmail.com on 25 May 2010 at 10:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
THIS PATCH WORKS BUT IT STOPS THE ROOMS TO RECREATE..WHICH IS TOTALLY WRONG IN 
THIS PLACE. i WANT MY ROOMS TO RECREATE WHEN RE-LOGIN TAKES PLACE

Original comment by gaurav.a...@classicinformatics.com on 15 Mar 2013 at 8:46