Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EOFException when loading keystore file

 
Tom Katz
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had my webapp running in secure mode with Jetty (5.1.3), and I hadn't tried it for a few days. Since then our install started using the jdk1.4.2.08 (not sure if that's relevant, but I think its the only thing that changed.)

Now when I try to start an HTTPS listener, I'm getting the below stack. I'm using the same keystore file, same passwords, same jetty jars, etc.

Anyone seen a similar error or have ideas of what to try? I'd really appreciate any help!!! I've been googling my brain out - but to no avail.


***************************************************

17:14:27.921 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:185) >15> jetty.ssl.keystore=D:\install_dir/jre/bin/localhost.jks
17:14:27.921 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:189) >15> jetty.ssl.password=**********
17:14:27.921 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:195) >15> jetty.ssl.keypassword=**********
17:14:27.921 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:200) >15> jetty.ssl.keystore.type=jks
17:14:27.921 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:225) >15> jetty.ssl.keystore.provider.name=[DEFAULT]
17:14:27.921 WARN!! [Thread-0] org.mortbay.util.ThreadedServer.start(ThreadedServer.java:518) >12> Failed to start: Listener@0.0.0.0:8443
17:14:27.921 WARN!! [Thread-0] org.mortbay.jetty.Server.main(Server.java:438) >08> EXCEPTION
org.mortbay.util.MultiException[java.io.EOFException]
at org.mortbay.http.HttpServer.doStart(HttpServer.java:733)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:268)
at java.io.DataInputStream.readFully(DataInputStream.java:242)
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:647)
at java.security.KeyStore.load(KeyStore.java:652)
at org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:228)
at org.mortbay.http.JsseListener.newServerSocket(JsseListener.java:193)
at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.mortbay.util.ThreadedServer.start(ThreadedServer.java:503)
at org.mortbay.http.SocketListener.start(SocketListener.java:203)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:763)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
[0]=java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:268)
at java.io.DataInputStream.readFully(DataInputStream.java:242)
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:647)
at java.security.KeyStore.load(KeyStore.java:652)
at org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:228)
at org.mortbay.http.JsseListener.newServerSocket(JsseListener.java:193)
at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.mortbay.util.ThreadedServer.start(ThreadedServer.java:503)
at org.mortbay.http.SocketListener.start(SocketListener.java:203)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:763)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
 
Tom Katz
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmm... Okay.. forget that first call-stack - that may have been due to me running it in our local jre/bin directory. I think the real problem was obscured by a different error in that location. It seems my self-signed jks file, even though its expiration date wasnt until 2032 has crapped out. If I create a new one - it works fine. Even in the jre/bin director (we've since moved it)

Here's the call-stack I get when I move the 'outdated' keystore to its regular home in the webapps folder:

*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
09:16:47.393 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:189) >15> jetty.ssl.password=**********
09:16:47.393 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:195) >15> jetty.ssl.keypassword=**********
09:16:47.393 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:200) >15> jetty.ssl.keystore.type=jks
09:16:47.393 INFO [Thread-0] org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:225) >15> jetty.ssl.keystore.provider.name=[DEFAULT]
09:16:47.408 WARN!! [Thread-0] org.mortbay.http.JsseListener.newServerSocket(JsseListener.java:217) >14> EXCEPTION
java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(KeyProtector.java:301)
at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:103)
at java.security.KeyStore.getKey(KeyStore.java:289)
at com.sun.net.ssl.internal.ssl.X509KeyManagerImpl.<init>(DashoA6275)
at com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl.engineInit(DashoA6275)
at javax.net.ssl.KeyManagerFactory.init(DashoA6275)
at com.sun.net.ssl.KeyManagerFactorySpiWrapper.engineInit(DashoA6275)
at com.sun.net.ssl.KeyManagerFactory.init(DashoA6275)
at org.mortbay.http.SunJsseListener.createFactory(SunJsseListener.java:232)
at org.mortbay.http.JsseListener.newServerSocket(JsseListener.java:193)
at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.mortbay.util.ThreadedServer.start(ThreadedServer.java:503)
at org.mortbay.http.SocketListener.start(SocketListener.java:203)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:763)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)

09:16:47.408 WARN!! [Thread-0] org.mortbay.util.ThreadedServer.start(ThreadedServer.java:518) >12> Failed to start: Listener@0.0.0.0:8443
09:16:47.408 WARN!! [Thread-0] org.mortbay.jetty.Server.main(Server.java:438) >08> EXCEPTION
org.mortbay.util.MultiException[java.io.IOException: Could not create JsseListener: java.security.UnrecoverableKeyException: Cannot recover key]
at org.mortbay.http.HttpServer.doStart(HttpServer.java:733)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
java.io.IOException: Could not create JsseListener: java.security.UnrecoverableKeyException: Cannot recover key
at org.mortbay.http.JsseListener.newServerSocket(JsseListener.java:218)
at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.mortbay.util.ThreadedServer.start(ThreadedServer.java:503)
at org.mortbay.http.SocketListener.start(SocketListener.java:203)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:763)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
[0]=java.io.IOException: Could not create JsseListener: java.security.UnrecoverableKeyException: Cannot recover key
at org.mortbay.http.JsseListener.newServerSocket(JsseListener.java:218)
at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.mortbay.util.ThreadedServer.start(ThreadedServer.java:503)
at org.mortbay.http.SocketListener.start(SocketListener.java:203)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:763)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)

*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*

Anyone recognize these errors as pointing to a reason why my keystore file suddenly went bad??
 
Tom Katz
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the keystore file was bad/corrupted - seems to be due to me adding it to CVS without using the proper binary file params.

The file would work, but only for about a week. And when I would create a new key and replace the old one with it, the size of the new one was almost double that of the old. I dont quite understand that part of it yet, especially since I'd created both files the same way. But the reason I'm pretty convinced that the file was corrupted by my not adding it to cvs as a binary file, is because when I used the original JKS file from my desktop (that I had eventually committed with cvs and was being used by the web-app) things would work okay. While the version from cvs would no longer work.

ugh, anyway hope this will help, if anyone runs into the same problem...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic