JBoss Fuse 6.2中的JPA问题

时间:2015-06-10 19:02:45

标签: jbossfuse fuseesb

我正在尝试在JBoss Fuse 6.2中实现JPA应用程序。附加的文件是pom.xml,blueprint.xml和persistence.xml。它们在JBoss Fuse 6.1中运行良好。但我们总是得到错误"没有可用的供应商"在6.2中,部署进入"等待"阶段。 我相信问题出在" jpa"特征。在6.2中,当我执行"功能:info jpa"时,它将hibernate的包显示为jpa单元(mvn:org.hibernate.javax.persistence / hibernate-jpa-2.1-api / 1.0 .0.Final),而在6.1中,它是geronimo jpa包(mvn:org.apache.geronimo.specs / geronimo-jpa_2.0_spec / 1.1)。我认为这导致OpenJPA失败,因为OpenJPA符合JPA 2.0而不是2.1。请指导如何解决这个问题。我试过不使用jpa功能,而是使用6.1版本的jpa功能包,但它也没有用。

的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>
&#13;
&#13;
&#13;

blueprint.xml

&#13;
&#13;
<?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>
&#13;
&#13;
&#13;

的persistence.xml

&#13;
&#13;
<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>
&#13;
&#13;
&#13;

0 个答案:

没有答案