Bah... No, i didn't.

I put the only one line to my code and it works fine. Thank you for the very
quick reply.

I ♥ MINA :)


Trustin Lee wrote:
> 
> On 10/29/07, balazsv <[EMAIL PROTECTED]> wrote:
>>
>> Hi!
>>
>> I have a client-server application. And i configured the server with MINA
>> 1.1.3 (SSL support). That works fine (I tested this with other, non-java
>> client). I'll create a client application, but the client can't connect
>> to
>> server. I get this exception only:
>>
>> javax.net.ssl.SSLHandshakeException: Initial 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:647)
>>         at
>> org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
>>         at
>> org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>         at java.lang.Thread.run(Thread.java:595)
>> Caused by: javax.net.ssl.SSLException: Received close_notify during
>> handshake
>>         at
>> com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1352)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1320)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1458)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:957)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:782)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:674)
>>         at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:566)
>>         at
>> org.apache.mina.filter.support.SSLHandler.unwrapHandshake(SSLHandler.java:636)
>>         at
>> org.apache.mina.filter.support.SSLHandler.handshake(SSLHandler.java:488)
>>         at
>> org.apache.mina.filter.support.SSLHandler.messageReceived(SSLHandler.java:306)
>>         at
>> org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:392)
>>         ... 8 more
>>
>> I get this after close client application. I think that my client is
>> wrong
>> (the handshake is forzen). This is the client SSL init function:
>>
>> String keyStore = properties.get("keystore");
>> String keyStorePass = properties.get("passphrase");
>>
>> KeyStore keystore = KeyStore.getInstance("JKS");
>> keystore.load(new FileInputStream(keyStore), keyStorePass
>>                 .toCharArray());
>>
>> TrustManagerFactory trustManager = TrustManagerFactory
>>                 .getInstance("SunX509");
>> trustManager.init(keystore);
>>
>> KeyManagerFactory keyManager = KeyManagerFactory
>>                 .getInstance("SunX509");
>> keyManager.init(keystore, keyStorePass.toCharArray());
>>
>> SSLContext sslContext = SSLContext.getInstance("TLS");
>> sslContext.init(keyManager.getKeyManagers(), trustManager
>>                 .getTrustManagers(), null);
>>
>> SSLFilter sslFilter = new SSLFilter(sslContext);
>> config.getFilterChain().addLast("SSL", sslFilter);
>>
>> System.out.println("Secure connection supported...");
>>
>> If i run this client and server without SSL, these are work fine. Please,
>> help me! Thanks!
> 
> Did you call SSLFilter.setClientMode(true)?
> 
> HTH,
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: 
http://www.nabble.com/SSL-client-connection-problem-tf4709237s16868.html#a13460683
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

Reply via email to