No Persistence provider for EntityManager error

577 views
Skip to first unread message

ErniB.

unread,
Jul 18, 2017, 7:11:23 AM7/18/17
to jBPM Development
Hello everyone 
I am using JBPM 6.3 to access a table from an Oracle database located in a schema other than JBPM. 
For this, I have defined the datasources in JBOSS EAP 6.4, as well as the Oracle XA driver. 

I have created a DataObject with a method to create an EntityManager and to be able to consult the table of Database mapped using JTA notation.

 When attempting to execute the "EntityManagerFactory emf = Persistence.createEntityManagerFactory (" desnorm ")" statement, the error "No Persistence provider for EntityManager named denorm" appears. 

 The persistence descriptor I have configured

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <persistence-unit name="desnorm" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/DATASOURCE2</jta-data-source>
        <class> ......... </class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
            <property name="hibernate.max_fetch_depth" value="3"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.id.new_generator_mappings" value="false"/>
            <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
        </properties>
    </persistence-unit>
</persistence>



Can anyone help me with this problem?

Thanks...



Maciej Swiderski

unread,
Jul 18, 2017, 8:13:13 AM7/18/17
to ErniB., jBPM Development
looks like you a typo somewhere in your code… see highlited part in red

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-developme...@googlegroups.com.
To post to this group, send email to jbpm-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-development/40e49733-3349-49e2-ad27-918ed4c414d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ErniB.

unread,
Jul 18, 2017, 8:26:10 AM7/18/17
to jBPM Development, ernes...@gmail.com
Thanks Maciej,.. 

ErniB.

unread,
Jul 18, 2017, 8:33:27 AM7/18/17
to jBPM Development, ernes...@gmail.com
Maciej, do you have any axample of code for reference?

ErniB.

unread,
Jul 18, 2017, 8:46:20 AM7/18/17
to jBPM Development, ernes...@gmail.com
Ohh ...excuse me Maciej, 
I was wrong to write then text...

The error message is the error "No Persistence provider for EntityManager named desnorm

Sorry... :-(

Maciej Swiderski

unread,
Jul 19, 2017, 2:15:35 AM7/19/17
to ErniB., jBPM Development
could you please provide bit more information on what you’re doing and what you’re trying to achieve.

Maciej

ErniB.

unread,
Jul 19, 2017, 4:00:36 AM7/19/17
to jBPM Development, ernes...@gmail.com
Hi Maciej...

Basically, what I want is to do a query in a Database (Oracle11g) table, located in other scheme that reserved for JBPM, that I have mapped in the JBPM project through a DataObject to launch signals to processes instances related to the results I get from the query.
The code for the dataobject is: 

package org.proyect.dataobjects;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

/**
 * This class was automatically generated by the data modeler tool.
 */

public class IncidenciaHorizontal_Controller implements java.io.Serializable {

    static final long serialVersionUID = 1L;
    public void IncidenciaHorizontal_Controller() {
       
    }
    
    public void Propaga_Incidencia_Controller() {
       EntityManagerFactory emf;
       EntityManager em;
       emf = Persistence.createEntityManagerFactory("desnorm");
       em =  emf.createEntityManager();
       Query namedQuery = em.createQuery("SELECT ..............");
       // process result after query execution.
       // the code, generate a signal for all instance process related with query results.
       // the query returns process instanceid signaled.
       
    }
}


I have a bpmn process with a script type task that executes the following code: 

...
org.proyect.dataobjects.IncidenceHorizontal_Controller IC = new org.proyect.dataobjects.IncidenciaHorizontal_Controller (); 
IC.Propaga_Incidencia_Controller ();
...

I have also tried this:

package org.proyect.dataobjects;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.*;

public class Incidencia_Horizontal implements java.io.Serializable
{
   @PersistenceContext(unitName = "desnorm")
   private EntityManager entityManager;

   public Incidencia_Horizontal()
   {
      System.out.println("entitymanager inyected= " + entityManager ) ;    
   }

   public void Propaga_Incidencia()
   {
        System.out.println("...................................... invoke Propaga_Incidencia...................");
        Query namedQuery = entityManager.createQuery("SELECT IDPROCED FROM V_TRAM_PERSON WHERE IDPERSON = to_number(:idperson)");
        namedQuery.setParameter("idperson",72415);
        //...................
   }
}

In this case, entityManager allways is null ...


My POM file is:

  <modelVersion>4.0.0</modelVersion>
  <groupId>org.proyect</groupId>
  <artifactId>PIA</artifactId>
  <version>380</version>
  <name>PIA</name>
  <description>Incident Proyect </description>
  <properties>
    <hibernate.version>4.2.0.Final</hibernate.version>
    <hibernate.core.version>4.2.0.Final</hibernate.core.version>
  </properties>
  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.kie</groupId>
        <artifactId>kie-maven-plugin</artifactId>
        <version>6.3.0.Final-redhat-5</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
</project>


Thanks Maciej .....
Maciej
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-development+unsub...@googlegroups.com.

Maciej Swiderski

unread,
Jul 19, 2017, 10:18:38 AM7/19/17
to ErniB., jBPM Development
ok, so you actually place the perssitence.xml into your project/kjar. That won’t work without changing the class loaders but I don’t think you should be using JPA at all.

Use plain JDBC to look up data source and then run the query. Search on google how to write class that will perform data source look up from JNDI and execute select statement on connection from data source.

Maciej

ErniB.

unread,
Jul 20, 2017, 2:18:27 AM7/20/17
to jBPM Development, ernes...@gmail.com
Thanks again Maciej...
I try it and I'll tell you the result ... 

A greeting..

ErniB.

unread,
Jul 21, 2017, 4:01:02 AM7/21/17
to jBPM Development, ernes...@gmail.com
Maciej, 
The connection to the database is already working properly using your indications..

Thanks... 

A greeting
Reply all
Reply to author
Forward
0 new messages