powered by Jive Software

I meet a exception : Unrecognized SSL message, plaintext connection

I use smack 2.0 API to communicate with wildfire2.5 in linux(I use wildfire_2_5_1.tar.gz to install the server).

My programe is like this:

this.server = “192.168.0.163”;

this.port = 5223;

this.username = “robot”;

this.password = “1234”;

this.resource = “Exodus”;

while (true) {

try {

// ******* connection *******

connection = new XMPPConnection(this.server, this.port);

MessageTypeFilter mtf = new MessageTypeFilter(

Message.Type.CHAT);

connection.addPacketListener(messageListener, mtf);

String connID = connection.getConnectionID();

Log.ShowByLine(connection.isConnected() + “:” + connID);

// ******* login *******

connection.login(this.username, this.password);

while (true) {

Thread.sleep(3000); // 3 seconds

if (connection.isConnected() == false)

break;

}

} catch (Exception ex) {

ex.printStackTrace();

}

Log.ShowByLine(“waiting for reconnection…”);

Thread.sleep(10000);// 10 seconds

}

connection.isConnected() is true , but I have the exception in connection.login():

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:5 01)

at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:343)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:720)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImp l.java:1025)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:10 38)

at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:10 53)

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

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

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

I use the same program in windowsXP with wildfire2.4 , all run well, but when i change the system to be linux, the exception occures. why ??

Thank you!

Hi,

why do you try to use port 5223? It’'s the old SSL port and may not be right for XMPPConnection() (I did not check the javadocs). Using port 5222 and TLS for an encrypted connection should work fine.

LG

This is the problem and the fix if you want to recompile smack

http://www.jivesoftware.org/community/thread.jspa?threadID=19926&tstart=0