Error when getting a File and putting in process Case
Hi all,
I'm writing a process that must start when a PDF file comes to a folder, and then, use this file (PDF ) in a Dialog to show it to the user -I guess that I can reference in a a-href HTML tag the file to open it by clicking on the link, but I'm not sure if that it's the best way to do it-. I have implemented a ch.ivyteam.ivy.process.eventstart.beans.FilePickupStartEventBean start, and this is working fine. Then, in a script step, I'm trying to put the file in context in order to use it later in forms the way I've explained. So I've got a subprocess like:
![alt text][1]
![alt text][2]
With this code inside script step:
import ch.ivyteam.ivy.workflow.document.IDocumentService;
File file = new File(in.pdfPath,true);
ivy.case.documents().add(file.getName());
But now, I'm getting this error:
IvyScriptMethodNotFoundException: Method add(String) for class ch.ivyteam.ivy.workflow.internal.document.LegazyCaseDocumentService of classloader org.eclipse.osgi.internal.loader.EquinoxClassLoader@6eae3730[ch.ivyteam.ivy.workflow:6.6.0.201704281153(id=100)] not found IvyScriptRuntimeException: IvyScript Runtime Exception in Instruction: ivy.case.documents().add(file.getName()) Block: es.jcd.axonivy.altapersonal.AltaEmpleadoData out; out = in; File file = new File(in.pdfPath, true); ivy.case.documents().add(file.getName()); BpmError: ivy:error:script RequestException: ivy:error:script Process Start Event Bean ch.ivyteam.ivy.process.eventstart.beans.FilePickupStartEventBean [class=ch.ivyteam.ivy.process.eventstart.beans.FilePickupStartEventBean, path=15BECE1340C42A33/eventLink.ivp] fire has been failed
[errorId=15CB194B8537DCC2, request=Business Processes/02_Alta_Personal_Impl.mod/eventLink.ivp(4.4.0.0), session=0 (SYSTEM), task=4, application=2147483647, requestId=76, executionContext=SYSTEM, pmv=designer$JCD_Alta_Personal$1]
ch.ivyteam.ivy.request.RequestException: ivy:error:script
at ch.ivyteam.ivy.request.RequestException$RequestExceptionBuilder.build(RequestException.java:166)
at ch.ivyteam.ivy.bpm.engine.internal.BpmEngine.handleNormalRequest(BpmEngine.java:194)
at ch.ivyteam.ivy.bpm.engine.internal.BpmEngine.handleRequestWithinContext(BpmEngine.java:140)
at ch.ivyteam.ivy.request.impl.ContextAwareRequestHandler.handleRequest(ContextAwareRequestHandler.java:32)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanEngine.handleRequest(ProcessStartEventBeanEngine.java:442)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanRuntime.fireProcessStartEventRequest(ProcessStartEventBeanRuntime.java:229)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanRuntime.fireProcessStartEventRequestAsSystem(ProcessStartEventBeanRuntime.java:202)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanRuntime$3.call(ProcessStartEventBeanRuntime.java:142)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanRuntime$3.call(ProcessStartEventBeanRuntime.java:1)
at ch.ivyteam.ivy.security.internal.SecurityManager.executeAsSystem(SecurityManager.java:1313)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanRuntime.fireProcessStartEventRequest(ProcessStartEventBeanRuntime.java:137)
at ch.ivyteam.ivy.process.eventstart.beans.FilePickupStartEventBean.processFile(FilePickupStartEventBean.java:160)
at ch.ivyteam.ivy.process.eventstart.beans.FilePickupStartEventBean.findAndReadFiles(FilePickupStartEventBean.java:111)
at ch.ivyteam.ivy.process.eventstart.beans.FilePickupStartEventBean.poll(FilePickupStartEventBean.java:362)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanHolder.pollInContext(ProcessStartEventBeanHolder.java:163)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanHolder.pollInternal(ProcessStartEventBeanHolder.java:148)
at ch.ivyteam.ivy.process.eventstart.internal.ProcessStartEventBeanHolder$PollJob.execute(ProcessStartEventBeanHolder.java:559)
at ch.ivyteam.ivy.job.internal.JobManager$1.call(JobManager.java:382)
at ch.ivyteam.ivy.job.internal.JobManager$1.call(JobManager.java:1)
at ch.ivyteam.util.callable.ExecutionContextContainer$ContainerExecutionContext.call(ExecutionContextContainer.java:92)
at ch.ivyteam.ivy.security.internal.SecurityManager.executeInContext_aroundBody0(SecurityManager.java:1365)
at ch.ivyteam.ivy.security.internal.SecurityManager.executeInContext_aroundBody1$advice(SecurityManager.java:41)
at ch.ivyteam.ivy.security.internal.SecurityManager.executeInContext(SecurityManager.java:1)
at ch.ivyteam.util.callable.ExecutionContextContainer$ContainerExecutionContext.call(ExecutionContextContainer.java:88)
at ch.ivyteam.util.callable.ExecutionContextContainer.executeInContext(ExecutionContextContainer.java:27)
at ch.ivyteam.ivy.job.internal.JobManager.execute(JobManager.java:376)
at ch.ivyteam.ivy.job.internal.Job.run(Job.java:56)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[errorId=15CB194B8537DCC2, request=Business Processes/02_Alta_Personal_Impl.mod/eventLink.ivp(4.4.0.0), session=0 (SYSTEM), task=4, application=2147483647, requestId=76, executionContext=SYSTEM, pmv=designer$JCD_Alta_Personal$1, processElement=15BECE1340C42A33-S40-f15]
Caused by: BpmError ivy:error:script
Unique ID: 15CB194B8537DCC2
Process Element: Subir PDF al proceso <15BECE1340C42A33-S40-f15>
at ch.ivyteam.ivy.bpm.error.BpmErrorBuilder.build(BpmErrorBuilder.java:204)
at ch.ivyteam.ivy.bpm.engine.restricted.error.BpmErrorConverter.toBpmError(BpmErrorConverter.java:30)
at ch.ivyteam.ivy.bpm.exec.restricted.scripting.BpmIvyScriptExecutor.executionException(BpmIvyScriptExecutor.java:117)
at ch.ivyteam.ivy.scripting.restricted.execution.AbstractIvyScriptExecutor.execute(AbstractIvyScriptExecutor.java:167)
at ch.ivyteam.ivy.bpm.exec.restricted.scripting.BpmIvyScriptExecutor.execute(BpmIvyScriptExecutor.java:84)
at ch.ivyteam.ivy.bpm.exec.internal.activity.script.ScriptExecutor.execute(ScriptExecutor.java:31)
at ch.ivyteam.ivy.bpm.exec.internal.activity.script.ScriptExecutor.execute(ScriptExecutor.java:1)
at ch.ivyteam.ivy.bpm.engine.internal.model.bpmn.SimpleActivityExecutorAdapter.execute(SimpleActivityExecutorAdapter.java:36)
at ch.ivyteam.ivy.bpm.engine.internal.model.ProcessElement.lambda$0(ProcessElement.java:215)
at ch.ivyteam.ivy.bpm.engine.internal.model.ProcessElement.executeInElementContext(ProcessElement.java:286)
at ch.ivyteam.ivy.bpm.engine.internal.model.ProcessElement.execute(ProcessElement.java:215)
at ch.ivyteam.ivy.bpm.engine.internal.core.ProcessElementExecution.execute(ProcessElementExecution.java:37)
at ch.ivyteam.ivy.bpm.engine.internal.core.RequestProcessor.handleExecution(RequestProcessor.java:140)
at ch.ivyteam.ivy.bpm.engine.internal.core.RequestProcessor.processRequest(RequestProcessor.java:130)
at ch.ivyteam.ivy.bpm.engine.internal.core.RequestProcessor.handleRequest(RequestProcessor.java:95)
at ch.ivyteam.ivy.bpm.engine.internal.core.RequestProcessor.handleRequest(RequestProcessor.java:77)
at ch.ivyteam.ivy.bpm.engine.internal.BpmEngine.handleNormalRequest(BpmEngine.java:190)
... 30 more
[errorId=15CB194B8537DCC2, request=Business Processes/02_Alta_Personal_Impl.mod/eventLink.ivp(4.4.0.0), session=0 (SYSTEM), task=4, application=2147483647, requestId=76, executionContext=0 (SYSTEM), pmv=designer$JCD_Alta_Personal$1, processElement=15BECE1340C42A33-S40-f15]
Caused by: ch.ivyteam.ivy.scripting.exceptions.runtime.IvyScriptRuntimeException: IvyScript Runtime Exception in
Instruction:
ivy.case.documents().add(file.getName())
Block:
es.jcd.axonivy.altapersonal.AltaEmpleadoData out;
out = in;
File file = new File(in.pdfPath, true);
ivy.case.documents().add(file.getName());
at ch.ivyteam.ivy.scripting.internal.language.IvyScriptEnginePerformer.wrapException(IvyScriptEnginePerformer.java:1672)
at ch.ivyteam.ivy.scripting.internal.language.IvyScriptEnginePerformer.visitControlInstructionInvoke(IvyScriptEnginePerformer.java:678)
at ch.ivyteam.ivy.scripting.internal.language.ControlInstructionInvoke.acceptControlInstructionVisitor(ControlInstructionInvoke.java:98)
at ch.ivyteam.ivy.scripting.internal.language.ControlInstruction.acceptInstructionVisitor(ControlInstruction.java:55)
at ch.ivyteam.ivy.scripting.internal.language.IvyScriptEnginePerformer.execute(IvyScriptEnginePerformer.java:170)
at ch.ivyteam.ivy.scripting.internal.language.IvyScriptEnginePerformer.execute(IvyScriptEnginePerformer.java:126)
at ch.ivyteam.ivy.scripting.internal.language.IvyScriptEngine.executeInternal(IvyScriptEngine.java:312)
at ch.ivyteam.ivy.scripting.internal.language.IvyScriptEngine.execute(IvyScriptEngine.java:281)
at ch.ivyteam.ivy.scripting.restricted.execution.AbstractIvyScriptExecutor.executeInstruction(AbstractIvyScriptExecutor.java:197)
at ch.ivyteam.ivy.bpm.exec.restricted.scripting.BpmIvyScriptExecutor.lambda$0(BpmIvyScriptExecutor.java:90)
at ch.ivyteam.ivy.security.internal.SecurityContext.executeAs(SecurityContext.java:1289)
at ch.ivyteam.ivy.bpm.exec.restricted.scripting.BpmIvyScriptExecutor.executeSecurely(BpmIvyScriptExecutor.java:103)
at ch.ivyteam.ivy.bpm.exec.restricted.scripting.BpmIvyScriptExecutor.executeInstruction(BpmIvyScriptExecutor.java:90)
at ch.ivyteam.ivy.scripting.restricted.execution.AbstractIvyScriptExecutor.execute(AbstractIvyScriptExecutor.java:158)
... 43 more
[errorId=15CB194B8537DCC2, request=Business Processes/02_Alta_Personal_Impl.mod/eventLink.ivp(4.4.0.0), session=0 (SYSTEM), task=4, application=2147483647, requestId=76, executionContext=0 (SYSTEM), pmv=designer$JCD_Alta_Personal$1, processElement=15BECE1340C42A33-S40-f15]
Caused by: ch.ivyteam.ivy.scripting.exceptions.invocation.IvyScriptMethodNotFoundException: Method add(String) for class ch.ivyteam.ivy.workflow.internal.document.LegazyCaseDocumentService of classloader org.eclipse.osgi.internal.loader.EquinoxClassLoader@6eae3730[ch.ivyteam.ivy.workflow:6.6.0.201704281153(id=100)] not found
at ch.ivyteam.ivy.scripting.internal.language.IvyScriptEnginePerformer.visitControlInstructionInvoke(IvyScriptEnginePerformer.java:631)
... 55 more
Any idea?
TIA
[1]: http://answers.axonivy.com/upfiles/Image_3_ReciWmX.png
[2]: http://answers.axonivy.com/upfiles/Image_5.png