Reproduce illlegal ThreadStateexception message


I am trying to perform the encrypt & decrypt of test string using the service “wm.openpgp:execPGPs” & it is successful. But the problem what I am facing is the same service is being used in Production environment for encryption & decryption but the constant debug message like “got an iltse” are being written to nohup.out file.

Got an iltse means " Illegal Thread of Exception"

But everything is working fine as expected in Dev & Test environment.

Here is the part of code below which present in all environments, I request if any one can help me out on how to reproduce the message in dev or test environment so that I can take the necessary action to fix the issue permanently. Also It would be very helpful to know the root cause why constant messages are being written to nohup only for PROD.

Please take a look on the below code & suggest me if I have to perform any changes.

if (!_timedout) {
if (_waitForExit) {

do {
try {
// Need to sleep a bit before getting exit code
_xit = proc.exitValue();
} catch (InterruptedException ie) {
/* IGNORE */
} catch (IllegalThreadStateException iltse) {
System.out.println(“got an iltse”);
} while (!(_timedout = (System.currentTimeMillis() > end)));
} else {
try {
_xit = proc.exitValue();
} catch (IllegalThreadStateException iltse) {
_timedout = true;

if (_timedout) {
System.out.println("timeout on: " + _command);
if (_destroyOnTimeout) {


This is more a Java question than WM question.
You may want to post to some Java forume.

I guess to reproduce, you need to find what action/event is triggering the Illegal Thread State. That will require to look into what you are doing within these threads. I can see proc.exit is the only real thing you are doing here, look into it.

Did you compare the prod env setup with dev/qa why that is working and not prod?

Do you see missing any package library files to execute or thread issuesor any config related adjustments required to get this execute properly? Has it worked before?


Generally we come across this exception when we are invoking thread more than once. Please cross check, how and from where this is getting invoked and let us know the lattest updates.