<!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="http://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;">
Exception while trying to access java return value
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/snyperboss">snyperboss</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/628557#628557">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hello all,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I am getting exception while trying to access the java method return value. Below are my source files.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>HelloWorld.jpdl.xml:</p><p>###################</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><?xml version="1.0" encoding="UTF-8"?></p><p><span>  <process name="HelloWorld" xmlns="</span><a class="jive-link-external-small" href="http://jbpm.org/4.4/jpdl" target="_blank">http://jbpm.org/4.4/jpdl</a><span>"></span></p><p>            <start g="127,111,38,30" name="start1"></p><p>                    <transition name="to PrintHelloWorld" to="PrintHelloWorld"</p><p>                              g="-91,-18" /></p><p>          </start></p><p>            <java class="com.jap.san.HelloWorldTest" g="496,126,80,47"</p><p>                    method="printHelloWorld" name="PrintHelloWorld" var="returnValue"></p><p>                    <transition g="-42,-18" name="to end1" to="end1" /></p><p>          </java></p><p>   <end g="634,132,29,27" name="end1" /></p><p></process></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>HelloWorldTest.java:</p><p>##################</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>package com.jap.san;</p><p>import java.io.Serializable;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>public class HelloWorldTest implements Serializable{</p><p>            </p><p>            public String printHelloWorld() {</p><p>              </p><p>                      System.out.println(" hi hi hi here @@@@@@");</p><p>              return "from method";</p><p>            }</p><p>  </p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Test file:</p><p>######################</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>ProcessEngine processEngine = new Configuration().setResource("jbpm.cfg.xml").buildProcessEngine();</p><p>                    RepositoryService repositoryService = processEngine.getRepositoryService();</p><p>                    ExecutionService executionService = processEngine.getExecutionService();</p><p>                    repositoryService.createDeployment().addResourceFromClasspath("com/jpmc/san/HelloWorld.jpdl.xml").deploy();</p><p>                    ProcessInstance processInstance =executionService.startProcessInstanceByKey("HelloWorld");</p><p>                    String pid = processInstance.getId();</p><p>                    String answer = (String) executionService.getVariable(pid, "returnValue");</p><p>                    System.out.println("answer");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>It error out on in the  line</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>String answer = (String) executionService.getVariable(pid, "returnValue");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>19:58:26,064 INF | [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd@b9b8d0</p><p>org.jbpm.api.JbpmException: execution HelloWorld.7 doesn't exist</p><p>          at org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:60)</p><p>          at org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:36)</p><p>          at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)</p><p>          at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:50)</p><p>          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)</p><p>          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)</p><p>          at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)</p><p>          at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)</p><p>          at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.getVariable(ExecutionServiceImpl.java:131)</p><p>          at com.jpmc.san.TestDeployment.main(TestDeployment.java:34)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/628557#628557">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://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>