I wrote some code to help me manage the keystores/SSLs that I use with my J2EE application server. In two places, I run the keytool command, using Runtime.getRuntime(), but I am starting to see some java.io.IOException: Not enough space errors. The diskspace looks good, and the Heap size of the jvm looks good.
Anyways, I want to try and convert this so it does not fork and execute (and will remove the issue that I am seeing), but instead use java.security.Keystore instead (or something better).
Here are the parts of the code, I'd like to convert:
Process keytool = Runtime.getRuntime().exec(params);
Looking at information on using java.security.KeyStore (KeyStore.Builder, KeystoreSpi), I got lost rather quickly. Anyone else use these? or have some good examples I could use to help muddle my way into fixing this?
I have not looked at the process builder, I'll take a look at that. It might get around the IOException error. Though, I would ultimately like to move this inside the code.. but if changeing to this processbuilder, it will work for now. thanks!
No worries, there have been several discussions on this forum lately about runtime.exec() and why ProcessBuilder is 'better'. I'm too lazy right now to dig them up but if you search this forum for runtime.exec you'll see some useful discussions and links.
Not really. I only see the error on our production server and I am unable to take it down. Our Development and Quality seem fine.
We run Weblogic 9.2 as the j2ee engine (running on Solaris, if that helps), using that I looked at the memory usage
Heap Size Current: 3758096384
Heap Free Current: 1364779736
Heap Free Percent: 36
Heap Size Max: 3758096384
Total Physical Memory: 17179869184
Thanks for that, I think you're right it looks like there's enough JVM memory. Next Q, do you know where the keystore work is being done on the physical disk, the IOException indicating out of space could be referring to a genuine out of space on physical disk problem (perhaps it is writing to a small mount point, or a user dir that is restricted in size).
With respect to your problems with exec() and ProcessBuilder, could you be running out of file descriptors? Each Process has an output stream and one or two input streams which should be closed once you’re finished with them. Otherwise they will eventually be closed some time after the process and the streams are garbage collected.