-
Bug
-
Resolution: Done
-
Critical
-
6.0.1
-
None
Description of problem:
I would like to change the default implementation of UserGroupCallback which is used by business-central (kie-wb).
I have changed business-central.war/WEB-INF/beans.xml with following line :
<class>org.jbpm.kie.services.cdi.producer.LDAPUserGroupInfoProducer</class>
Looking at https://github.com/droolsjbpm/jbpm/blob/6.0.0.GA.x/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/identity/LDAPUserGroupCallbackImpl.java apparently I need to provide jbpm.usergroup.callback.properties.
It seems that I have two options - either to specify location with system property jbpm.usergroup.callback.properties OR drop this property files on the root of classpath.
Unfortunately both options are not functional at the moment.
1) Define location of property file with system property
String propertiesLocation = System.getProperty("jbpm.usergroup.callback.properties");
InputStream in = this.getClass().getResourceAsStream(propertiesLocation);
This is not a way how to load external files, this will try to load file relatively from the root of classpath.
The correct way how to load external files could look like this :
private Properties config;
InputStream is = new FileInputStream(System.getProperty("jbpm.usergroup.callback.properties"));
config.load(is);
I haven't submitted a pull request as the story goes on.
2) Use default location which is
protected static final String DEFAULT_PROPERTIES_NAME = "/jbpm.usergroup.callback.properties";
However, this does not work either, because apparently this class is picked up by different classloader, coming from jboss module.
So, the workaround is to add this property files directly in the org.jbpm module, like this:
$ pwd
bpm6/jboss-eap-6.1/modules/system/layers/bpms/org/jbpm/main
$ $ ls -1 | grep properties
properties.jar
$ unzip -l properties.jar
Archive: properties.jar
Length Date Time Name
--------- ---------- ----- ----
50 04-03-2014 14:53 jbpm.usergroup.callback.properties
--------- -------
50 1 file
$ cat module.xml | grep properties
<resource-root path="properties.jar"/>
This workaround is not really nice, and it will obviously not work in other container.
Both attempts - 1 && 2 fails with
if (this.config == null)
I haven't pasted the complete exception because there is not really anything to add. If I apply the workaround the properties file is correctly loaded.
Version-Release number of selected component (if applicable):
How reproducible:
always
Steps to Reproduce:
Please see verbose description.
Actual results:
Properties file is not loaded when its location is specified by system property.
Properties file is not loaded when it is dropped under business-central.war/WEB-INF/classes
Expected results:
Properties file is loaded when its location is specified by system property.
Properties file is loaded when it is dropped under business-central.war/WEB-INF/classes
Additional info: