"no response from the server", socket closed and SSLKeyException

I use Apache JAMES to receiver email, at the time i receive an email, i wiil send a message to a jabber server…

Please help me , thx in advance…


the “compute” is localhost

there is my src

ConnectionConfiguration config = new ConnectionConfiguration(destination, 5222, destination);
config.setDebuggerEnabled(true);
XMPPConnection connection = new XMPPConnection(config);
SmackConfiguration.setPacketReplyTimeout(15000);
try {
connection.connect();
log("Connected to " + connection.getHost());
} catch (XMPPException ex) {
log(ex.getMessage());
log("Failed to connect to " + connection.getHost());
System.exit(1);
}
try {
connection.login("hp", "hp");
log(("Logged in as " + connection.getUser()));
} catch (XMPPException evt) {
// TODO Auto-generated catch block
log(evt.getMessage());
System.exit(1);
}

The log is :

15/06/08 02:18:37 INFO James.Mailet: SpecialCallHostProcess: Destination: computer

15/06/08 02:19:23 INFO James.Mailet: SpecialCallHostProcess: Connected to computer

15/06/08 02:19:38 INFO James.Mailet: SpecialCallHostProcess: No response from the server.

That’s the Excepton:

Using PHOENIX_HOME: E:\TDdownload\james-binary-2.3.1\james-2.3.1

Using PHOENIX_TMPDIR: E:\TDdownload\james-binary-2.3.1\james-2.3.1\temp

Using JAVA_HOME: D:\Program Files\Java\jdk1.6.0_03

Phoenix 4.2

James Mail Server 2.3.1

Remote Manager Service started plain:4555

POP3 Service started plain:110

SMTP Service started plain:25

NNTP Service started plain:119

FetchMail Disabled

java.net.SocketException: Socket closed

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)

at java.net.SocketOutputStream.write(SocketOutputStream.java:136)

at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)

at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)

at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)

at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)

at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)

at java.io.BufferedWriter.flush(BufferedWriter.java:236)

at org.jivesoftware.smack.util.ObservableWriter.flush(ObservableWriter.j

ava:48)

at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:25

at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:40)

at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:87)

javax.net.ssl.SSLKeyException: RSA premaster secret error

at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKey

Exchange.java:97)

at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientH

andshaker.java:574)

at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHa

ndshaker.java:197)

at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:5

at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.jav

a:454)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.j

ava:884)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SS

LSocketImpl.java:1096)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketIm

pl.java:1123)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketIm

pl.java:1107)

at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnecti

on.java:1127)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:31

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

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

Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyG
enerator not available

at javax.crypto.KeyGenerator.<init>(DashoA13*…)

at javax.crypto.KeyGenerator.getInstance(DashoA13*…)

at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(JsseJce.java:223

)

at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKey

Exchange.java:89)

… 12 more

Actually

In debug window

the RawSendPackets is

<stream:stream to=“computer” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams” version=“1.0”>

<starttls xmlns=“urn:ietf:params:xml:ns:xmpp-tls”/>

the RawReceiverPackets is

<?xml version=‘1.0’ encoding=‘UTF-8’?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“computer” id=“f97af83e” xml:lang=“en” version=“1.0”><stream:features><starttls xmlns=“urn:ietf:params:xml:ns:xmpp-tls”></starttls><mechanisms xmlns=“urn:ietf:params:xml:ns:xmpp-sasl”><mechanism>DIGEST-MD5</mec hanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS< /mechanism><mechanism>CRAM-MD5</mechanism></mechanisms>< compression xmlns=“http://jabber.org/features/compress”><method>zlib</method></compression><auth xmlns=“http://jabber.org/features/iq-auth”/><register xmlns=“http://jabber.org/features/iq-register”/></stream:features>

<proceed xmlns=“urn:ietf:params:xml:ns:xmpp-tls”/>

is so strange that the log said there was no response from the server, but it has responsed that.

The processing is as follow:

System.out.println("Try to connect : " + destination); //i got Try to connect : computer

try {

connection.connect();// i got socketException: socket closed,SSLKeyException, so strange…

System.out.println("Connected to " + connection.getHost());// i got Connected to computer

} catch (XMPPException ex) {

System.out.println(ex.getMessage());

System.out.println("Failed to connect to " + connection.getHost());

System.exit(1);

}

System.out.println("Try to log in with the name : " + “hp”);

try {

connection.login(“hp”, “hp”);//NullPointException

System.out.println(("Logged in as " + connection.getUser()));

} catch (XMPPException evt) {

// TODO Auto-generated catch block

System.out.println(evt.getMessage());// no response from the server

System.exit(1);

}

/code

Client Connection Security

|

Optional - Clients may connect to the

server using secured connections.

Required - Clients can only connect to

the server using secured connections.

Custom - Advanced configuration

Old SSL method:

Not Available Available

TLS method:

Not Available Optional Required

|

Server Connection Security

|

Optional - Connections between servers

may use secured connections.

Required - Connections between servers

always use secured connections.

Custom - Advanced configuration

Server Dialback:

Not Available Available

TLS method:

Not Available

Optional

|

i set all Not Available. the it works

but i don’t know the reason.