-
1. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
horvie Nov 21, 2014 8:42 AM (in response to kannan123)I got it to work by implementing my own producer:
@ApplicationScoped
@Alternative
@Selectable
public class DBUserGroupInfoProducer implements UserGroupInfoProducer {
private UserGroupCallback callback = new DBUserGroupCallback(true);
private UserInfo userInfo = new DBUserInfo(true);
@Override
@Produces
public UserGroupCallback produceCallback() {
return callback;
}
@Override
@Produces
public UserInfo produceUserInfo() {
return userInfo;
}
}
and specified it as alternative in beans.xml:
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
<alternatives>
<class>DBUserGroupInfoProducer</class>
</alternatives>
</beans>
-
2. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
kannan123 Nov 23, 2014 11:13 PM (in response to horvie)Hi David
Thank you for your answer. Can you specify this a little bit more explained, means step by step how can i do this. Because i am new to jboss. Also i have tried to find the beans.xml in the installer path. But i cannot.
Regards
Kannan
-
3. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
horvie Nov 24, 2014 2:02 AM (in response to kannan123)Hi. Didn't know you are using installer. We are using standalone WildFly without jbpm-console.war or kie-workbench.war so our workflow is a bit different from yours. As far as I could inspect, there is jbpm-console.war package inside /jbpm-installer/wildfly-8.1.0.Final/standalone/deployments folder. Inside the jbpm-console.war there is a /WEB-INF folder containing beans.xml. You should replace this file with your own. You shoul also drop a jar containing your DBUserGroupCallback and producer implementation inside /WEB-INF/lib. Again, I must mention that we don't use the istaller, so there may be a better way. But that whould be my fist step towards finding a solution.
-
4. Re: Re: To register DBUserGroupCallbackImpl with jboss as 7.1
kannan123 Nov 25, 2014 1:12 AM (in response to horvie)Hi
i have my custom DBUserGroupCallbackImpl attached and i included this in the beans.xml as you mentioned in the last post. But still the task not assigning to the user
Regards
Kannan
-
DBUserGroupCallbackImpl.java 4.4 KB
-
-
5. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
horvie Nov 25, 2014 2:02 AM (in response to kannan123)1 of 1 people found this helpfulThe problem is with CDI not picking up you implementation.
And jBPM 6.1 already has an implementation that you need.
If you check the source code you will see that there is existing DBUserGroupInfoProducer (http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jbpm/jbpm-kie-services/6.1.0.Final/org/jbpm/kie/services/cdi/producer/DBUserGroupInfoProducer.java) and it is producing DBUserGroupCallbackImpl (http://grepcode.com/file/repo1.maven.org/maven2/org.jbpm/jbpm-human-task-core/6.1.0.Final/org/jbpm/services/task/identity/DBUserGroupCallbackImpl.java).
So instead of providing your implementation, you can specify DS_JNDI_NAME, PRINCIPAL_QUERY, USER_ROLES_QUERY and ROLES_QUERY as app properties (db.ds.jndi.name, db.user.query, db.user.roles.query and db.roles.query) and dropping in beans.xml:
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
<alternatives>
<class>org.jbpm.kie.services.cdi.producer.DBUserGroupInfoProducer</class>
</alternatives>
</beans>
-
6. Re: Re: To register DBUserGroupCallbackImpl with jboss as 7.1
kannan123 Nov 25, 2014 5:59 AM (in response to horvie)Hi David
i followed these links and changed the configuration accordingly. But still no success. Please find the attachments.
Regards
kannan
-
DBUserGroupCallbackImpl.java 4.4 KB
-
AbstractUserGroupInfo.java 1.5 KB
-
DBUserGroupInfoProducer.java 996 bytes
-
beans.xml 1.0 KB
-
-
7. Re: Re: Re: To register DBUserGroupCallbackImpl with jboss as 7.1
horvie Nov 25, 2014 9:12 AM (in response to kannan123)I think you've mixed up CDI beans and Spring beans.
The beans.xml file we are configuring is one for CDI, not Spring. For CDI we can't define beans within <bean> element. We define them with annotations, via producers etc. We can only specify <alternatives>, <decorators> and <interceptors>. Your beans.xml should have exactly this content (and put it inside a jbpm-console.war /WEB-INF/):
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
<alternatives>
<class>org.jbpm.kie.services.cdi.producer.DBUserGroupInfoProducer</class>
</alternatives>
</beans>
As for properties, by default they are read from classpath file jbpm.usergroup.callback.properties. So create and put on classpath (inside a jbpm-console.war /WEB-INF/classes/) a file with this name and content:
db.ds.jndi.name=java:/mysqlDSJNDI
db.user.query=select password from test.principles where principal_id=?
db.user.roles.query=select user_role, 'Roles' from test.roles where principal_id=?
db.roles.query=select user_role, 'Roles' from test.roles where principal_id=?
That is all.
You do not have to implement anything, all other classes (DBUserGroupInfoProducer, DBUserGroupCallbackImpl ...) should already be available from jars of jbpm distribution (specificaly: jbpm-human-task-core-6.1.0.Final.jar, jbpm-kie-services-6.1.0.Final.jar).
P.S.: I don' know why properties file is zipped at upload. Extract it and use a .properites file.
-
beans.xml 335 bytes
-
jbpm.usergroup.callback.properties.zip 315 bytes
-
-
8. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
kannan123 Nov 25, 2014 11:40 PM (in response to horvie)Hi David
Still no success. Let me ask one thing, is it necessary to use the same packages as the default classes appears like?
Regards
kannan
-
9. Re: Re: To register DBUserGroupCallbackImpl with jboss as 7.1
horvie Nov 26, 2014 1:47 AM (in response to kannan123)Let's try with the approach you were trying at the beginning.
You need the 3 classes in the attachment (you must put them on the classpath) and the beans file.
You can change the package si.artes.bpm.cdi to anything you like (but if you change it in the java files, be sure you do it in beans.xml also). Other imports must stay the same, because the CDI injection to jBPM engine desides based on that exact classes/interfaces.
When you are using your application you should see in jboss log file: "Producing: si.artes.bpm.cdi.DBUserGroupCallbackImpl". If you don't, it means your classes aren't on the classpath and CDI can't use them for jBPM.
-
DBUserGroupCallbackImpl.java 4.5 KB
-
DBUserGroupInfoProducer.java 1.1 KB
-
DBUserInfo.java 1.1 KB
-
beans.xml 317 bytes
-
-
10. Re: Re: Re: To register DBUserGroupCallbackImpl with jboss as 7.1
kannan123 Nov 26, 2014 7:42 AM (in response to horvie)Hi
The "Producing: si.artes.bpm.cdi.DBUserGroupCallbackImpl" is not there in the server log. Please find the attachement
Regards
Kannan
-
server.log.zip 12.7 KB
-
-
11. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
horvie Nov 26, 2014 10:59 AM (in response to kannan123)I believe we have located the source of the problem.
I just assumed that you are using jBPM 6, but from your log files it seems like you are accualy using an older version. If that is the case, nothing that we talked abut will work, because the new version is using different approach to user management (among many other things).
If this is your first jBPM project I strongly recommend using the latest version (6.1.0.Final).
What version are you using?
-
12. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
kannan123 Nov 26, 2014 9:52 AM (in response to horvie)Currently we are using jbpm 5.4. If i migrate the same to jbpm 6.1.0 final do my workflows and other configuration remains same or needs the modification.
Kannan
-
13. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
horvie Nov 26, 2014 10:45 AM (in response to kannan123)Unfortunately not. Some migration would be need.
If you have many existing processes/projects and all you need to add is getting users from your own DB, it is probably best to resolve the issue with your current version.
Here is some more info: How to modify jbpm-console to make it retrieve user and role list from database?
-
14. Re: To register DBUserGroupCallbackImpl with jboss as 7.1
kannan123 Nov 26, 2014 11:12 PM (in response to horvie)But i can login with my database user. I have done this through by creating a MySQL datasource The problem is cannot assign task to the users.
Regards
Kannan