2

我对 Java 和 Java EE 还是很陌生,我正在做一个项目,我想使用 2 个数据源(MySQL+Cassandra)实现 JPA(MySQL 的休眠和 Cassandra 的 Kundera)。我的 persistence.xml 如下:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    version="2.0">
    <persistence-unit name="mysqlPU" transaction-type="JTA">
        <description>MySQL Persistent Unit</description>
        <jta-data-source>java:jboss/datasources/MySQLRemote</jta-data-source>
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>com.eventit.entities.Event</class>
    <class>com.eventit.entities.Group_icon</class>
    <class>com.eventit.entities.Group</class>
    <class>com.eventit.entities.User</class> 
    </persistence-unit>
<persistence-unit name="cassandraPU">
    <provider>com.impetus.kundera.KunderaPersistence</provider>
    <properties>
        <property name="kundera.nodes" value="10.0.0.13" />
        <property name="kundera.port" value="9160" />
        <property name="kundera.keyspace" value="KunderaKeyspace" />
        <property name="kundera.dialect" value="cassandra" />
        <property name="kundera.client.lookup.class"
            value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
        <property name="kundera.cache.provider.class"
            value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
        <property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
    </properties>
</persistence-unit>

但是当我在 JBoss(AS 7.1)上部署我的项目时,我收到以下错误:

02:56:22,428 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."Event-it5.5.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."Event-it5.5.jar".INSTALL: Failed to process phase INSTALL of deployment "Event-it5.5.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]
Caused by: javax.persistence.PersistenceException: JBAS011466: PersistenceProvider 'com.impetus.kundera.KunderaPersistence' not found
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.lookupProvider(PersistenceUnitDeploymentProcessor.java:555)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:295)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:258)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleJarDeployment(PersistenceUnitDeploymentProcessor.java:145)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:120)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more

mysqlPU 工作得很好,但是当我添加 cassandraPU 时,我得到了例外。我很确定我正在将具有依赖关系的 kundera.jar 正确部署到 jboss,因为我可以http://127.0.0.1:9990/console/App.html#deployments 提前在Thanks 中看到 jar,并希望我已经提供了所有必要的东西。

4

1 回答 1

2

希望这可以帮助。

https://groups.google.com/forum/#!msg/kundera-discuss/3-iUJQOShvE/kJihv32IbjYJ

看一看。

-维维克

于 2012-06-25T19:14:40.587 回答