I try to change approach.
Suppose I do not install JBPM in JBOSS (so I do not have the folder "jbpm" under the Jboss deploy directory but more important I have no dependicies with a datasource) and all the JBPM clients are web applications that can use a different datasource, deployed in JBOSS by the usual *-ds.xml file.
If now I deploy an ear file (to enclose both web application and a custom version of jbpm-enterprise that not only refers to the JNDI name defined in the datasource already deployed but also allows the access to the JBPM EJBs (namely CommandServiceBean, TimerServiceBean, etc.)), with the correct JBPM configuration (jbpm.cfg.xml and hibernate.cfg.xml file, the last refers to the same JNDI datasource name), every process that I will deploy (by jbpmContext.deployProcessDefinition method) or every process instance that I will create (processDefinitio.createProcessInstance method) in the web application, will refer to the correct JBPM database.
Is it correct?
Are there any problems about this approach (for example the deploy of another ear, the access to the JBPM EJBs or something else)?
this should work.