Use smack to connect to openfire3.3.0 (wildfire)

I developed an application by using the library smack to connect server jabber, I can connect to the jabber.org or jabber.fr but not my local server wildfire, I have much exception. I re-examined the code several times but I do not find the error. host= " localhost " port=5222 is it right?

CODE

public void actionPerformed(java.awt.event.ActionEvent e) {

try {

cb = new CyclicBuffer(bufferSize);

if (SSL) {

con = new SSLXMPPConnection(host, port);

} else {

con = new XMPPConnection(host, port);

PacketFilter filter = new AndFilter(new PacketTypeFilter(Message.class),new FromContainsFilter(jTextField3.getText()));

PacketListener myListener = new PacketListener() {

public void processPacket(Packet packet) {

if (packet instanceof Message) {

msg = (Message) packet;

System.out.println(“Private Message received: " + msg.getBody()); jTextArea1.append(msg.getFrom()*”: “*msg.getBody()+”\n");

}

}

};

// Register the listener.

con.addPacketListener(myListener, filter);

//----


}

// Most servers require you to login before performing other tasks

con.login(username, passwd);

chat = con.createChat(jTextField1.getText());

} catch (Exception er) {

System.out.println(“error”);

}

}

});

}

return jButton1;

}

exceptions are:

java.lang.Exception: TLS negotiation has failed

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

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

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

java.lang.IllegalStateException: Not connected to server.

at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:663)

at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication .java:54)

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 212)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:384)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:330)

at com.Paquet.MonApplication.ClasseMonApplication$1.actionPerformed(ClasseMonAppli cation.java:179)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

THANK YOU TO HELP ME

I am not an expert but it seems that the server (at localhost) you are trying to connect to is there and accepting connections. Only TLS negotiation seems to fail. In my eyes you have two choices. Either disable TLS or try to figure out what fails when connecting (I would try first to blame the certificate [selfsigned or similar]).

null

Thanks for the answer!

but i don’‘t resolve my problem yet, i don’‘t understand why my code working with my local server ejabberd1.1.3 and don’'t with openfire3.3.0(local server too) .

i use smack3.0.0 first i have an error in line ConnectionConfiguration i add smack 2.2.1,it is right.

now i have an error in line config.setReconnectionAllowed(true); (error:The method setReconnectionAllowed (boolean) is indefinite for the ConnectionConfiguration type )

if you have an exemple of right code please give me the adresse .

THANK’'S

i have just replace smack3.3.0 with smack 2.2.1 and it work with no problems!!

package paquet;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.packet.Packet;

public class ConnexionServeurJabber {

static XMPPConnection connection;

static String hostXMPP= “myMachine”;

static void Connection ()

{

try{

connection = new XMPPConnection(hostXMPP);

connection.login(“Login”,“Password”);

}

catch (Exception er){System.out.println(“Probleme with connexion to Jabber serveur”);

}

}

}