Bug 973193

Summary: Build & deploy does not create package directory structure in .jar deployments and does not include process definitions
Product: [Retired] JBoss BRMS Platform 6 Reporter: Jiri Svitak <jsvitak>
Component: Business CentralAssignee: manstis
Status: CLOSED CURRENTRELEASE QA Contact: Marek Baluch <mbaluch>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: etirelli, kverlaen, lpetrovi, mbaluch, rrajasek, rzhang
Target Milestone: DR6   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:17:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Svitak 2013-06-11 12:53:16 UTC
Build & deploy does not create package directory structure in .jar deployments. I wanted to create a project with groupId com.bpms.flood. I was able to find the deployment both in GUI and REST API, but no process definitions inside. I found out that the .jar file contained just folder with name "com.bpms.flood", which contained only default WorkDefinitions.wid instead of expected directory structure com/bpms/flood.

I guess that this is the reason why also the process definition was not included in the deployment .jar.

To reproduce:
1. Login to business-central.
2. Create new git repo. Create new project and package named "com.bpms.flood".
3. Inside the package create a simple process and save it.
4. Open project and add a session ksession1 to kmodule.xml. (I think this could be fixed as well - that the project should forbid here the name "default" as it later complains when deploying. Also the name of the session is later usually invisible. I'll file a new bugzilla for this.)
5. Try to Build & Deploy and try to run the process instance either in gui or rest api. Investigate the local maven repo and content of the .jar file.

My environment:
business-central.war - BPMS 6 DR5

Comment 1 Mauricio Salatino 2013-06-13 11:52:31 UTC
Hi, this is the Project Editor responsibility, and it's not related with the jbpm side. This issues should be assigned to Michael Anstis or Toni Rikkola, or at least ask them who is responsible for the Project Editor screen and how the assets and projects are generated.

Comment 2 Edson Tirelli 2013-06-19 14:10:27 UTC
Just to make sure I understand the problem: is the problem that the process definition is not included in the generated kjar?

Comment 3 Edson Tirelli 2013-06-19 14:17:01 UTC
As explained during the call, it happens only when a custom package name is used. In that case, the process definition is not added to the kjar.

Comment 4 Marek Baluch 2013-06-19 20:06:27 UTC
Edson,

I just tried out the following:

1) create a new project in any predefined repository (I used jbpm-playground.git)

I tried four possibilities I think can happen in a project in the resources directory:

1) don't create a package but you create a process definition
2) create the defaultPackage and a process definition in it
3) create a com/jboss/flood package and a process definition in it
4) create a com.jboss.flood package and a process definition in it

Every time I hit build & deploy then the following happens for the cases above

1) WorkDefinitions.wid is included without the process definition
2)3)4) directory structure is included with the WorkDefinitions.wid in the directories but no process definition.

Comment 6 Kris Verlaenen 2013-06-20 01:52:43 UTC
Marek,

I believe this might also be caused by the "default" kbase that is automatically added (in Beta3 at least) to a new project.  Could you try the following, immediately after create a new project:

 - open the project editor
 - open the kmodule.xml tab
 - remove the "default" kbase
 - save the file

Now try adding a new process and doing Build & Deploy on that, the process should show up in the jar after a successful build.

This means a user would have to manually remove the "default" kbase every time he creates a new project.  I've asked Maciej to identify the commit that fixes this in master, so we can consider if we want to cherry-pick this on top of Beta3 as a possible solution.

Kris

Comment 7 Marek Baluch 2013-06-20 08:38:50 UTC
Kris,

removing the default kbase as described above works. Processes are included on each level.

This solution has one problem. It generates the following segment in kmodule.xml

<kbase name="defaultKieBase" default="true" ...>
    <ksession name="..." default="true" .../>
</kbase>

When such a project is deployed the the server restart will fail. Which is this bug:

https://bugzilla.redhat.com/show_bug.cgi?id=975820

Marek

Comment 8 Marek Baluch 2013-06-20 14:17:29 UTC
It may not be the same issue after all.

The NPE is thrown on a different line.

org.jbpm.kie.services.impl.KModuleDeploymentService.deploy(KModuleDeploymentService.java:68)

Comment 9 Marek Baluch 2013-06-20 14:19:21 UTC
... meaning the server may fail to start not because of BZ-975820.

Comment 10 Kris Verlaenen 2013-06-20 17:49:48 UTC
Marek,

Are you using an in memory database?  If so, the session that is was using before for execution will no longer be there (as the database is empty), and that's why it's probably complaining (the link between the deployment and the session is stored in a .ser file inside the server data dir).

Could you try either:
 - removing the .ser file(s) inside 
 - configuring a datasource that would survive a restart, like file-based h2

Note that we have fixed this to not fail on this any more (simply create a new ksession in that case) for Beta4).

Kris

Comment 11 Marek Baluch 2013-06-21 14:38:05 UTC
To summarize all the findings to get this working:

On the new project after it was created:
 - open the project editor
 - open the kmodule.xml tab
 - remove the "default" kbase
 - save the file

Then when you made changes (either to kmodule.xml or you just added a new process or an existing process  definition has been updated)

 - open the project editor
 - open the pom.xml tab
 - change (e.g. increase) the version
 - save the file

You're ready to "build and deploy".

Comment 12 Kris Verlaenen 2013-06-27 00:16:47 UTC
Fixed in Beta4

Comment 13 Marek Baluch 2013-07-11 10:46:46 UTC
Verified on DR6.