Thread being destroyed?

I am writing a servlet in jboss that will basically facilitate ajax calls to a persistent XMPPConnection.

however, I think the threads for the connection are somehow being destroyed, but i can’'t be sure.

I am using a bean that has session scope to do all the actual communication to the XMPP server (wildfire)

here is the code for the bean:

package com.medcentrex;

import org.jivesoftware.smack.*;

import org.jivesoftware.smack.filter.*;

import org.jivesoftware.smack.packet.*;

import java.util.*;

public class Demo{

protected HashMap<String, PacketCollector> chatStacks=new HashMap<String, PacketCollector>();

protected XMPPConnection con;

protected String username;

protected String password;

protected String server=“redmond.curbsidemd.com”;

HashMap<String, Chat> chats=new HashMap<String, Chat>();

PacketCollector roster;

protected boolean logged_in=false;

public Demo(){}

public boolean login(String username, String password)

throws XMPPException{

this.username=username;

this.password=password;

con=new XMPPConnection(server);

con.login(username, password);

logged_in=con.isAuthenticated();

if(logged_in){

//yay, we logged in

}else{

con.close();

}

return logged_in;

}

public boolean getLogged_In(){

return logged_in;

}

}

the login happens perfectly, i check getLogged_In after the login method is called.

but nearly immediately after this process i see a problem in the log

what i see in the log:


java.lang.NullPointerException

at org.xmlpull.mxp1.MXParser.isNameStartChar(MXParser.java:3136)

at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1253)

at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:382)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:63)

Exception in thread “Smack Packet Reader”

java.lang.NullPointerException

at org.jivesoftware.smackx.ServiceDiscoveryManager$2.connectionClosedOnError(Servi ceDiscoveryManager.java:146)

at org.jivesoftware.smack.PacketReader.notifyConnectionError(PacketReader.java:215 )

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:389)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:63)

answered my own question. firewall was blocking creation of extra UDP ports that were getting created.