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?
Yes JAR file for this entity class is there in class path and also have added the same as a dependencies in jBPM project
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.
please note that you might need to use 6.1 beta version for this feature.
can you pls guide how to update my jar in jBPM using kmodule?
Hi, Did you find a solution for this issue? I am facing the same issue using EAP 6.1 with jBPM.
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/test.bpmn <---- References TaskRequest.java in project2 below
project2 (contains my model)
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 -->
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]
My jars were packaged via maven and deploy via workbench (not built). Use maven to package workbench to deploy and it should work.
thanks for your reply. It is really helpful. I converted my java project into maven project. it worked now.