Problem with java and SSL Exception

For the last 2 weeks we had a problem with email sending on one of our servers (hosted on EC2). Our emails are sent through Amazon SES, which used to work great until a problem with SSL connections on Amazon SES came up. Since that time we started receiving complaints that some clients didn’t receive email confirmations. We investigated the issue (checked our error logs) and it seemed that we had to wait until Amazon fixes the issue (at least that’s what we thought). Amazon fixed the issue very quickly but we continued having problems. Today we found the solution by noticing that on one of the servers emails were being sent without any problem. And we noticed that on that server we had installed openjdk-6 instead of openjdk-7 as on the other server. Therefore we switched to openjdk-6 and it all started working normally!

Therefore, if you get an error similar to the one blow then we would recommend that you switch to openjdk-6 instead of openjdk-7.

Note: We tried configuring a completely new server (thinking that a SSL certificate needed to be updated) but didn’t help. Switching to openjdk-6 did the job ūüôā

Here is the error:

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[MessagingException: Exception reading response]]
	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	at akka.actor.Actor$class.apply(Actor.scala:318) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at play.core.ActionInvoker.apply(Invoker.scala:113) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	at akka.actor.ActorCell.invoke(ActorCell.scala:626) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at akka.dispatch.Mailbox.run(Mailbox.scala:179) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
	at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) ~[com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
Caused by: javax.mail.MessagingException: Exception reading response
	at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at javax.mail.Service.connect(Service.java:297) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at javax.mail.Service.connect(Service.java:156) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at javax.mail.Service.connect(Service.java:105) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at fly.play.ses.Ses$.sendEmail(Ses.scala:49) ~[nl.rhinofly.api-ses_2.9.1-api-ses_2.9.1-1.0.1.jar:1.0.1]
	at facade.Emails$.sendActivationEmail(Emails.scala:15) ~[easygogym_2.9.1-0.1.jar:0.1]
	at controllers.Users$$anonfun$sendActivationEmail$1.apply(Users.scala:116) ~[easygogym_2.9.1-0.1.jar:0.1]
	at controllers.Users$$anonfun$sendActivationEmail$1.apply(Users.scala:114) ~[easygogym_2.9.1-0.1.jar:0.1]
	at play.api.mvc.Action$$anon$1.apply(Action.scala:170) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	at play.utils.Threads$.withContextClassLoader(Threads.scala:17) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:125) ~[play.play_2.9.1-play_2.9.1-2.0.6.jar:2.0.6]
	... 11 common frames omitted
Caused by: javax.net.ssl.SSLException: Server key
	at sun.security.ssl.Handshaker.throwSSLException(Handshaker.java:1274) ~[na:1.7.0_25]
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223) ~[na:1.7.0_25]
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868) ~[na:1.7.0_25]
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:804) ~[na:1.7.0_25]
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016) ~[na:1.7.0_25]
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312) ~[na:1.7.0_25]
	at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882) ~[na:1.7.0_25]
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:102) ~[na:1.7.0_25]
	at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) ~[na:1.7.0_25]
	at java.io.BufferedInputStream.read(BufferedInputStream.java:254) ~[na:1.7.0_25]
	at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75) ~[javax.mail.mail-mail-1.4.jar:1.4]
	at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440) ~[javax.mail.mail-mail-1.4.jar:1.4]
	... 25 common frames omitted
Caused by: java.security.spec.InvalidKeySpecException: Could not create EC public key
	at sun.security.pkcs11.P11ECKeyFactory.engineGeneratePublic(P11ECKeyFactory.java:169) ~[sunpkcs11.jar:1.7.0_25]
	at java.security.KeyFactory.generatePublic(KeyFactory.java:334) ~[na:1.7.0_25]
	at sun.security.ssl.HandshakeMessage$ECDH_ServerKeyExchange.(HandshakeMessage.java:1057) ~[na:1.7.0_25]
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:218) ~[na:1.7.0_25]
	... 36 common frames omitted
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DOMAIN_PARAMS_INVALID
	at sun.security.pkcs11.wrapper.PKCS11.C_CreateObject(Native Method) ~[sunpkcs11.jar:1.7.0_25]
	at sun.security.pkcs11.P11ECKeyFactory.generatePublic(P11ECKeyFactory.java:233) ~[sunpkcs11.jar:1.7.0_25]
	at sun.security.pkcs11.P11ECKeyFactory.engineGeneratePublic(P11ECKeyFactory.java:164) ~[sunpkcs11.jar:1.7.0_25]
	... 39 common frames omitted
Advertisements

Sublime Text 3 – new code browsing functionality

Just tried today for the first time Sublime Text 3!

It looks quite similar to Sublime Text 2 but it’s a bit faster (though ST2 was fast enough already for me) and has the following features that I fell in love with right away:

  1. Go to definition: Just put the cursor on any function and click F12 (in Windows or Linux). Then ST3 will take you to the function’s definition. If there are more than one, it’ll ask you which one to go to. It’s amazingly helpful feature and I’ll be using it all the time
  2. Jump back & Jump forward: This is the second best feature. Whenever you use Jump to definition (F12) you can use Jump back (Alt+Keypad minus) to get back to the code you were viewing before you jumped to definition. You can also Jump forward using Alt + Shift + Keypad minus.

I actually changed the key bindings to Alt+Left and Alt+Right which I find a bit more intuitive. You can do that by going to “Preferences” -> “Key Bindings – User” and setting the key bindings in a similar way like I did:

[
	{ "keys": ["alt+left"], "command": "jump_back" },
	{ "keys": ["alt+right"], "command": "jump_forward" }
]

Hope you will enjoy Sublime Text 3. It’s a really great editor!