powered by Jive Software

XMLNotWellFormedException error connect to openfire 3.8.1 when used smack libray:

smack enviroment:

smack version :smack.3.2.2

system: window7

JDK:1.7

openfire enviroment:

openfire version: 3.8.1

system: linux as5.1

JDK:1.6

the same client code it can success connect in windows7 enviroment(JDK 1.5),but error in linux(JDK 1.6).

smack code like below:

public boolean login(){
        boolean bResult=false;
         ConnectionConfiguration config=new ConnectionConfiguration(xmppIpAddress,5222);
           //config.setCompressionEnabled(true);
           //config.setSASLAuthenticationEnabled(false);
           //config.setDebuggerEnabled(true);
           connection=new XMPPConnection(config);
            try {
                connection.connect();
                System.out.println("user:"+user);
                System.out.println("password:"+password);
                connection.login(user, password);
                //connection.login("591123426@condy", "123456");
                bResult=true;
            } catch (XMPPException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return bResult;
    }
/**
     * @param args
     */
    public static void main(String[] args) {
        XMPPAgent xmppAgent=new XMPPAgent("3995","1234");
        xmppAgent.setXmppIpAddress("134.129.68.97");
        xmppAgent.login();
        //xmppAgent.joinWorkGroup("demo@workgroup.condy");
        /*for (int i = 0; i <60; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }*/
        xmppAgent.close();     }

openfire info.log and warn.log error message like below:

info.log:
2013.07.10 09:36:05 org.jivesoftware.openfire.nio.ConnectionHandler - ConnectionHandler reports IOException for session: (SOCKET, R: /134.132.32.38:52736, L: /134.129.68.97:5222, S: 0.0.0.0/0.0.0.0:5222)
javax.net.ssl.SSLHandshakeException: SSL handshake failed.
        at org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:416)
        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
        at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
        at org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageReceived(AbstractIoFilterChain.java:499)
        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
        at org.apache.mina.common.support.AbstractIoFilterChain.fireMessageReceived(AbstractIoFilterChain.java:293)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:228)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
        at com.sun.net.ssl.internal.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:152)
        at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:806)
        at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:721)
        at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:607)
        at org.apache.mina.filter.support.SSLHandler.unwrap0(SSLHandler.java:658)
        at org.apache.mina.filter.support.SSLHandler.unwrapHandshake(SSLHandler.java:614)
        at org.apache.mina.filter.support.SSLHandler.handshake(SSLHandler.java:493)
        at org.apache.mina.filter.support.SSLHandler.messageReceived(SSLHandler.java:306)
        at org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:392)
        ... 14 more
warn.log:
2013.07.10 09:36:10 org.jivesoftware.openfire.nio.ConnectionHandler - Closing session due to exception: (SOCKET, R: /134.132.32.38:52736, L: /134.129.68.97:5222, S: 0.0.0.0/0.0.0.0:5222)
org.apache.mina.filter.codec.ProtocolDecoderException: org.jivesoftware.openfire.nio.XMLNotWellFormedException: Character is invalid in: ^V (Hexdump: 16 03 01 00 95 01 00 00 91 03 01 51 DC BF AD BC EE CB A1 26 7D 6C 10 81 99 E3 C3 F2 43 CA 26 79 2F 1D 5F 11 FF B5 F7 74 5A 1B 3D 00 00 2A 00 33 C0 04 00 16 00 05 C0 03 C0 11 C0 02 C0 07 C0 13 C0 08 C0 0C 00 FF C0 0D C0 0E C0 09 00 2F C0 12 00 04 00 32 00 13 00 0A 01 00 00 3E 00 0A 00 34 00 32 00 17 00 01 00 03 00 13 00 15 00 06 00 07 00 09 00 0A 00 18 00 0B 00 0C 00 19 00 0D 00 0E 00 0F 00 10 00 11 00 02 00 12 00 04 00 05 00 14 00 08 00 16 00 0B 00 02 01 00)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:170)
        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
        at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
        at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:239)
        at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:283)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.jivesoftware.openfire.nio.XMLNotWellFormedException: Character is invalid in: ^V
        at org.jivesoftware.openfire.nio.XMLLightweightParser.read(XMLLightweightParser.java:208)
        at org.jivesoftware.openfire.nio.XMPPDecoder.doDecode(XMPPDecoder.java:41)
        at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:133)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:163)
        ... 9 more

Hi Condy,

Did you find the reason why this was happening?

Thanks.