Bug 1007055 - Uploading a JAR does not result in the data objects being available in the user interface
Summary: Uploading a JAR does not result in the data objects being available in the us...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ER5
: 6.0.0
Assignee: Walter Medvedeo
QA Contact: Radovan Synek
URL:
Whiteboard:
Depends On:
Blocks: bpms6_ux, brms6_ux
TreeView+ depends on / blocked
 
Reported: 2013-09-11 19:50 UTC by Catherine Robson
Modified: 2014-08-06 20:09 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Summary: Instead of the system informing the user about a JAR with unsatisfied dependencies, the system allows the upload of the JAR into a project. This then causes various issues in the Data Modeler, Guided Rules Editor and the Guided Decision Table with the Project unable to be used due to the unsatisfied dependency.
Clone Of:
Environment:
Last Closed: 2014-08-06 20:09:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
The added JAR (9.44 KB, application/x-java-archive)
2013-09-12 08:15 UTC, Pedro Zapata
no flags Details
external-pojos.jar (2.33 KB, application/x-java-archive)
2013-09-16 15:45 UTC, Walter Medvedeo
no flags Details
error message - Data Modeler (34.93 KB, image/png)
2013-10-18 10:42 UTC, Radovan Synek
no flags Details
error message - Guided Rule editor (39.42 KB, image/png)
2013-10-18 10:42 UTC, Radovan Synek
no flags Details
Dependencies check (51.49 KB, image/png)
2013-10-23 14:19 UTC, Walter Medvedeo
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1049674 0 high CLOSED Workbench generated maven projects should have the kjar type 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1063742 0 high CLOSED Relax external class validation to allow use of @PropertyReactive 2021-02-22 00:41:40 UTC

Internal Links: 1049674 1063742

Description Catherine Robson 2013-09-11 19:50:00 UTC
Description of problem:
User had a JAR file with some classes in it and uploaded this into their M2 repository.  They then added this as a dependency to their project, but the classes in this jar were not available anywhere within the project for use.


Version-Release number of selected component (if applicable):
6.0.0.ER2

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Pedro Zapata 2013-09-12 08:15:20 UTC
Created attachment 796669 [details]
The added JAR

Added the cigna.jar that was trying to be added as a dependency. Please note this .jar is missing dependencies, since the underlying error is a ClassNotFound exception for a class not present in the .jar file.

However, this error should be captured and displayed to inform the user that the jar is invalid either at the project import level and/or data modeler level.

Comment 3 Walter Medvedeo 2013-09-12 16:56:50 UTC
The provided cigna.jar file, has a class "Claim" (see below) with a member "private com.cigna.healthcare.claim.Member member;" but the class com.cigna.healthcare.claim.Member is not defined in the jar file.
When the build system tries to build the project a class not found exception is thrown. And the user gets an error popup with the following message:

Error: "An error occurred when the requested data model was loaded from server". The server error is: "java.lang.ClassNotFoundException:com.cigna.healthcare.claim.Member"



public class Claim  implements java.io.Serializable{
    private static final long serialVersionUID = 1L;
    private java.util.Date dateOfService;
    private java.lang.String claimId;
    private java.math.BigDecimal copay;
    private java.math.BigDecimal amountNotCovered;
    private java.math.BigDecimal allowableAmount;
    private java.lang.String description;
    private java.math.BigDecimal deductible;
    private java.math.BigDecimal amountBilled;
    private java.lang.String code;
    private java.lang.String patientName;
    private int age;
    private java.util.List<com.cigna.healthcare.claim.Service> listOfService;
    private com.cigna.healthcare.claim.Member member;

Comment 4 Walter Medvedeo 2013-09-16 15:42:08 UTC
When the test was done with a well formed .jar file (see the attached file external-pojos.jar) the following issue was found.

1) go to the "Guvnor M2 Repository Explorer" and upload the "external-pojos.jar" file.

2) Create an empty project

3) Go to the project dependencies and add a dependency to the "external-pojos" maven artifact loaded in step 1)

4) save the project.

5) Open the datamodeler and create a data object X.

6) Add a field Y to the data object X, of type "org.kie.external.ExternalClientBean".

(when you click on the field type combobox you will see an option " - ext - org.kie.external.ExternalClientBean". This means that you have a type to select that is form an external dependency).

7) Save the project.

8) When the project is saved you will see the following error in the "Problems window"

"	
org.kie.external.ExternalClientBean cannot be resolved to a type
	
-
	
240
	
10
	
"

Comment 5 Walter Medvedeo 2013-09-16 15:45:25 UTC
Created attachment 798326 [details]
external-pojos.jar

Comment 6 Mario Fusco 2013-09-17 13:26:57 UTC
The kproject classloader (the one also referring to the classes contained in external jars) was used to compile drl, but not java classes. I fixed this here https://github.com/droolsjbpm/drools/commit/12724f6c5

Comment 10 Radovan Synek 2013-10-18 10:41:28 UTC
Using external-pojos.jar as a dependency works just fine - I am able to see packages and class from this jar in Data Modeler, Guided Decision Table Wizard, etc.

However, using the cigna.jar results in buggy behaviour of all editors I tried with:

Guided Rule editor: Opens with white screen, no ability to edit, error message appears - see the attached screenshots.

Guided Decision Table: the same behaviour as Guided Rule editor. I case GDT with wizard has been chosen, the table cannot be even created - clicking on "OK" on "Create new" screen is without any response.

Data Modeler: Error message appears, after that there are no classes and no packages available. I expected to see classes and packages from the project and from other JAR files, but there is simply nothing.

I wonder if the JAR with unsatisfied dependencies could be somehow isolated and user informed about this JAR won't be included in the project? Using such a JAR as project's dependency should not break Business Central in this way.

Comment 11 Radovan Synek 2013-10-18 10:42:21 UTC
Created attachment 813710 [details]
error message - Data Modeler

Comment 12 Radovan Synek 2013-10-18 10:42:49 UTC
Created attachment 813711 [details]
error message - Guided Rule editor

Comment 13 Prakash Aradhya 2013-10-21 16:00:59 UTC
Walter, can you clarify what you mean by well formed jar ?  
Are there steps user should take defining the dependencies and/or create some definition file before uploading it ?
If so, it needs to be documented clearly.  Also, there should be appropriate error shown to the user if uploaded file does not meet the definition.

Comment 14 Mario Fusco 2013-10-22 08:55:39 UTC
There's no much I can do on the core side about this. I am reassigning this ticket to Walter who will trigger the project building in a try/catch block in order to try to report the problems encountered during the compilation phase in a more graceful way.

Comment 15 Walter Medvedeo 2013-10-23 14:17:59 UTC
Additional verification was added in order to detect mal formed .jars like the cigna.jar as earlier as possible. Typically when we manage the dependencies for a given project.

When we set the dependencies for a project and save it, the project is compiled. At this moment we will try to detect also errors in the dependencies .jar files. Obviously an external .jar file can have whatever thing, and eventually can come from whatever origin. So it can always have errors that we cant detect, etc.

With the verification added we can at least detect some mal formed cases like the cigna.jar and give some feedback to the user in the "Problems" widget.
When the user saves the project, If we detect an error in the dependencies jars It will be informed in the "Problems" widget.

In the attached screen I show the error message that the user will get when he updates de dependencies for a proyect using the cigna.jar file. (You must save the project in order to materialize the changes and do the internal verification)

Responding the previous query, a "well formed .jar file" in this context is a .jar file that don't have missing clases like the cignar.jar.
The cigna.jar file isn't well formed, because it have the following scenario.
A class X uses a class Y, but the class Y is not in the .jar file, and that's why this cigna.jar file generates the error.

Comment 16 Walter Medvedeo 2013-10-23 14:19:55 UTC
Created attachment 815438 [details]
Dependencies check

Comment 17 Walter Medvedeo 2013-10-23 14:21:28 UTC
The described improvement was implemented in the following commits.

master: http://github.com/droolsjbpm/guvnor/commit/b8eefe4bd

6.0.x: http://github.com/droolsjbpm/guvnor/commit/2349445b

Comment 18 Radovan Synek 2013-12-03 12:19:21 UTC
Verified on BRMS-6.0.0.ER5


Note You need to log in before you can comment on or make changes to this bug.