-
1. Re: passing and retrieving custom object in jBPM6
steljboss Apr 6, 2014 5:23 PM (in response to pandyajayn)Is it in the classpath of the process? I assume a dependency on the deployed jar containing the entity has been configured from the project?
-
2. Re: passing and retrieving custom object in jBPM6
pandyajayn Apr 6, 2014 5:57 PM (in response to steljboss)Yes JAR file for this entity class is there in class path and also have added the same as a dependencies in jBPM project
-
3. Re: passing and retrieving custom object in jBPM6
swiderski.maciej Apr 7, 2014 1:45 AM (in response to pandyajayn)the problem is current limitation - only kjar dependencies are scanned for classes, so add to your jar where you have the custom types META-INF/kmodule.xml and that should be recognized and registered as known class in JAXBContext on REST api server side.
This is sort of JAXBContext limitation as it must know all the classes in advance so classpath scanning would be required but it's inefficient and very time consuming especially for large classpath tree. So we are looking at the possible solutions for it and hopefully will add it for next version.
P.S.
please note that you might need to use 6.1 beta version for this feature.
HTH
-
4. Re: passing and retrieving custom object in jBPM6
pandyajayn Apr 7, 2014 7:58 PM (in response to swiderski.maciej)can you pls guide how to update my jar in jBPM using kmodule?
-
5. Re: passing and retrieving custom object in jBPM6
hitesh.pandya Jun 25, 2014 1:39 AM (in response to pandyajayn)Hi, Did you find a solution for this issue? I am facing the same issue using EAP 6.1 with jBPM.
-
6. Re: passing and retrieving custom object in jBPM6
ggcooper Sep 17, 2014 5:27 PM (in response to pandyajayn)Maciej answer above worked for me; however, I'll give an example to help illustrate the solution.
I was able to get this to work on 6.1.0.Final by simply adding a kmodule.xml to the jar file that contained my data class.
I have two projects, project1 contains my business processes and project2 contains my data model classes.
project1 (contains my bpmn's)
src/main/resources/META-INF/kmodule.xml
src/main/resources/test.bpmn <---- References TaskRequest.java in project2 below
project2 (contains my model)src/main/java/TaskRequest.java
src/main/resources/META-INF/kmodule.xml <----- ADDED THIS TO MAKE project2.jar a KJAR so the TaskRequest.class would be found by jBPM
contents of project2's kmodule.xml
<!-- empty kmodule to cause jBPM to scan this jar for data types: https://developer.jboss.org/thread/239542 -->
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"/>
-
7. Re: passing and retrieving custom object in jBPM6
stevenhu Sep 19, 2014 5:46 PM (in response to ggcooper)Hi, can you give some detailed suggestion on how to upload the business project contained custom object? Thank you very much.
Right now, I have two projects exactly same with yours in your illustration. Also I add a kmodule file(same with yours) into my java project and jbpm project respectively. And then I export them as jar respectively. Next, I upload them both into jbpm 6.1.0.Final wb. And create deployment unit for each. But I received an error:
2014-09-19 17:26:17,071 ERROR [org.drools.compiler.kie.builder.impl.AbstractKieModule] (default task-10) Unable to build KieBaseModel:kbase
Error importing : 'com.sample.MyVo'
Unable to build expression for action 'System.out.println("Hello,"+person.name);' :java.lang.ClassNotFoundException: Unable to find class 'com.sample.MyVo' : Process com.sample.bpmn.Sample Process(com.sample.bpmn.hello)
2014-09-19 17:26:17,237 WARN [org.jbpm.kie.services.impl.KModuleDeploymentService] (default task-10) Unexpected error while deploying unit com.sample:MySample:1.0: java.lang.IllegalStateException: Cannot find kbase, either it does not exist or there are multiple default kbases in kmodule.xml
at org.jbpm.kie.services.impl.KModuleDeploymentService.deploy(KModuleDeploymentService.java:106) [jbpm-kie-services-6.1.0.Final.jar:6.1.0.Final]
at org.jbpm.kie.services.impl.KModuleDeploymentService$Proxy$_$$_WeldClientProxy.deploy(Unknown Source) [jbpm-kie-services-6.1.0.Final.jar:6.1.0.Final]
at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl.deploy(DeploymentManagerEntryPointImpl.java:113) [jbpm-console-ng-business-domain-backend-6.1.0.Final.jar:6.1.0.Final]
at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl.deploy(DeploymentManagerEntryPointImpl.java:103) [jbpm-console-ng-business-domain-backend-6.1.0.Final.jar:6.1.0.Final]
at
-
8. Re: passing and retrieving custom object in jBPM6
ggcooper Sep 20, 2014 12:03 PM (in response to stevenhu)My jars were packaged via maven and deploy via workbench (not built). Use maven to package workbench to deploy and it should work.
-
9. Re: passing and retrieving custom object in jBPM6
stevenhu Sep 22, 2014 11:30 PM (in response to ggcooper)thanks for your reply. It is really helpful. I converted my java project into maven project. it worked now.