<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Update Process Definitions timeout - with solution.
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/john0945">John Lewis</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/795847#795847">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Summary: I resolved class java.io.IOException / timeout error when updating processes in the jBPM console by fixing errors in my process.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Hi. Just wanted to post something I've been struggling with. I installed jBPM5 with the installer, and started developing my own process. Everything was going smoothly, until after I added a XOR gateway. I started getting an errror when trying to update the processes in the jBPM console. I got a popup error message, and no process definitions, though there should have been three. Here's the error:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>2013-02-04 08:55:19,851 [DEBUG] GET: </span><a class="jive-link-external-small" href="http://localhost:8080/gwt-console-server/rs/process/definitions" rel="nofollow" target="_blank">http://localhost:8080/gwt-console-server/rs/process/definitions</a></p><p><span>2013-02-04 08:56:18,982 [ERROR] &lt;ul&gt;&lt;li&gt;URL: '</span><a class="jive-link-external-small" href="http://localhost:8080/gwt-console-server/rs/process/definitions" rel="nofollow" target="_blank">http://localhost:8080/gwt-console-server/rs/process/definitions</a><span>'</span></p><p>&lt;li&gt;Action: 'org.jboss.bpm.console.client.process.UpdateDefinitionsAction'</p><p>&lt;li&gt;Exception: 'class java.io.IOException'&lt;/ul&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Request timeout</p><p>java.io.IOException:</p><p>Request timeout</p><p>&#160;&#160;&#160; at Unknown.$fillInStackTrace_1(JsArrayString.java:42)</p><p>&#160;&#160;&#160; at Unknown.$IOException(StackTraceCreator.java:366)</p><p>&#160;&#160;&#160; at Unknown.run_17(AbstractRESTAction.java:120)</p><p>&#160;&#160;&#160; at Unknown.fire(Timer.java:141)</p><p>&#160;&#160;&#160; at Unknown.anonymous(Timer.java:60)</p><p>&#160;&#160;&#160; at Unknown.entry0(Impl.java:146)</p><p>&#160;&#160;&#160; at Unknown.anonymous(Impl.java:56)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I tried restarting the server, downloading new WAR files, redeploying the WAR files... everything I could think of. Sometimes it would work for a bit.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Eventually, I decided to first fix the compilation error I was getting when trying to build the package. In the conditions of the gateways (which are set on the branches leaving the gateway), I was trying to use a boolean process variable, but I was getting errors because the getVariable() method returns an object, which I was trying to cast to a boolean. After discovering this, I changed the code, and the build was successful. Here's the old and new code.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>OLD: boolean decision = (boolean)kcontext.getVariable("instock");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return decision;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>NEW: boolean decision = kcontext.getVariable("instock").equals(true);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return decision;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>For information on the getVariable() method, I used:</p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/process/instance/context/variable/VariableScopeInstance.html" rel="nofollow" target="_blank">http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/process/instance/context/variable/VariableScopeInstance.html</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>For information on the equals() method, I used:</p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/task/BooleanExpression.html" rel="nofollow" target="_blank">http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/task/BooleanExpression.html</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>After changing to the new code, I updated the processes and didn't get the timeout issue. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>To check I had actually solved it by changing the code, I reverted back to the old code. The process was now not valid, so the Console didn't update to the new version. I rebooted the server to force it to work with the invalid version. Now, the Console didn't pick up the invalid process at all (but successfully loads the other valid processes I have, without giving the timeout error).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>To attempt to recreate the timeout error, I reverted to an even older version of code (the version that was in use when the server booted up, and gave the timeout error). Here I tried to save an Object into a Boolean variable without casting.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>OLDER: boolean decision = (boolean)kcontext.getVariable("instock");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return decision;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>After changing back to this code, I restarted the server. It took a couple tries before the console and Guvnor showed in the browser, but when it did, the process still didn't show up. The timeout error didn't come back.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Then, I changed back to the new code, built the package and refreshed the processes in the Console. The process then showed up (without having to reboot).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>In conclusion, if you encounter a timeout error while updating the process definitions in the jBPM console, or the process doesn't show up, check that you can successfully build the package that the process is in. (This is done under the edit tab of the package, in Drools Guvnor. See section 3.6 of the jBPM installer guide for a video of how to do it. </span><a class="jive-link-external-small" href="http://docs.jboss.org/jbpm/v5.4/userguide/ch.installer.html#d0e571" rel="nofollow" target="_blank">http://docs.jboss.org/jbpm/v5.4/userguide/ch.installer.html#d0e571</a><span>).</span></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/795847#795847">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>