1 Reply Latest reply on Jun 15, 2015 3:06 AM by grgrzybek

    Issue with JPA in JBoss Fuse 6.2

    dave.muk

      I am trying to implement a JPA application in JBoss Fuse 6.2. The attached files are the pom.xml, blueprint.xml and persistence.xml. They are working fine in JBoss Fuse 6.1. But we are always getting the error "No providers available" in 6.2 and the deployment is going in "waiting" stage. I believe the problem is with the "jpa" feature. In 6.2, when I do "features:info jpa", it shows hibernate's bundle as the jpa unit ( mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final), whereas in 6.1, it was the geronimo jpa bundle (mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1). I believe that is causing OpenJPA to fail since OpenJPA is compliant with JPA 2.0 but not 2.1. Please guide on how to solve this problem. I have tried not to use the jpa feature and rather use the bundles of the jpa feature from 6.1 version but it did not help either.

       

      pom.xml

      <plugin>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-maven-plugin</artifactId>
      <version>${fabric.version}</version>
      <configuration>
      <profile>org-profile</profile>
      <parentProfiles>feature-cxf</parentProfiles>
      <features>fabric-cxf swagger cxf-jaxrs transaction jndi jpa camel-spring spring-orm spring-jdbc
      </features>
      <featureRepos>
      mvn:org.apache.cxf.karaf/apache-cxf/${version:cxf}/xml/features
      mvn:org.apache.camel.karaf/apache-camel/${version:camel}/xml/features
      </featureRepos>
      <bundles>
      mvn:mysql/mysql-connector-java/5.1.34
      mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_3
      mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/1.14.1_1
      mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections/3.2.1_3
      mvn:org.apache.openjpa/openjpa/2.3.0
      </bundles>
      </configuration>



      </plugin>



      blueprint.xml

      <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs" xmlns:cxf="http://cxf.apache.org/blueprint/core" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0" >  <jaxrs:server id="organizationService" address="/common"> <jaxrs:serviceBeans> <ref component-id="organizationServiceBean"/> </jaxrs:serviceBeans> <jaxrs:features> <bean class="org.apache.cxf.jaxrs.swagger.SwaggerFeature"/> </jaxrs:features> </jaxrs:server>  <cxf:bus> <cxf:features> <cxf:logging /> </cxf:features> </cxf:bus>  <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource"> <property name="driverClass" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://127.0.0.1:3306/test"/> <property name="username" value="user"/> <property name="password" value="pwd"/> </bean> <service ref="dataSource" interface="javax.sql.DataSource"> <service-properties> <entry key="osgi.jndi.service.name" value="jdbc/DataSource"/> </service-properties> </service>  <bean id="defOrganizationService" class="org.OrganizationDataServiceImpl"> <jpa:context unitname="PERSON"/> <tx:transaction method="*" value="Required"/> </bean> <bean id="defOrgchartService" class="org.OrgchartDataServiceImpl"> <jpa:context unitname="PERSON"/> <tx:transaction method="*" value="Required"/> </bean>  <bean id="organizationServiceBean" class="org.OrganizationService"> <property name="organizationDataService" ref="defOrganizationService"/> <property name="orgchartDataService" ref="defOrgchartService"/> </bean> </blueprint>


       

      persistence.xml

      <persistence-unit name="PERSON" transaction-type="JTA">
       
      <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        
      <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/DataSource)</jta-data-source>
        
      <!-- this is very important -->
       
      <class>org.Person</class>
       
      <exclude-unlisted-classes>true</exclude-unlisted-classes>
       
      <properties>
        
      <!-- Schema update -->
        
      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
        
      <!-- Specify dialect -->
        
      <property name="openjpa.jdbc.DBDictionary" value="mysql"/>
        
      <property name="openjpa.Log" value="File=C:/install/jboss-fuse-6.1.0.redhat-379/data/log/org.apache.openjpa.log, DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
        
      </properties>
        
      </persistence-unit>
      </persistence>