0

我正在尝试使用Kundera on jboss AS7.1.1.final.

以下是我遵循的步骤:

1.创建了一个模块(com.impetus.kundera),这里是module.xml

<module xmlns="urn:jboss:module:1.1" name="com.impetus.kundera" slot="2.0.7">
<resources>
    <resource-root path="kundera-core-2.0.7-SNAPSHOT.jar"/>
    <resource-root path="cglib-2.2.jar"/>
    <resource-root path="commons-logging-1.1.1.jar"/>
    <!-- Insert resources here -->
</resources>
<dependencies>
    <module name="javax.api"/>
    <module name="javax.persistence.api"/>
    <module name="javax.transaction.api"/>
    <module name="javax.validation.api"/>
    <module name="org.javassist"/>
    <module name="org.slf4j"/>
    <module name="org.apache.commons.lang"/>
    <module name="org.apache.commons.collections"/>
</dependencies>

复制 2.0.7 文件夹下的资源根路径 jars。

  1. 修改 persistence.xml 为:

<property name="jboss.as.jpa.providerModule" value="com.impetus.kundera:2.0.7" />

注意:我的 persistence.xml 在deployment/KunderaSampleApp.war/WEB-INF/classes/META-INF文件夹下,但不知何故我得到以下错误:


org.jboss.msc.service.StartException in service jboss.persistenceunit."KunderaSampleApp.war#personnel_cass_pu": 无法在 org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) 启动服务 [jboss -msc-1.0.2.GA.jar:1.0.2.GA] 在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_15] 在 java.util。 concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_15] at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_15] 原因: com.impetus.kundera.loader.PersistenceLoaderException:com.impetus.kundera.utils.InvalidConfigurationException:在 com.impetus.kundera.configure 的类路径中找不到任何 META-INF/persistence.xml 文件。PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:102) 在 com.impetus.kundera.configure.Configurator.configure(Configurator.java:63) 在 com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:96) 在 com.impetus .kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:71) at com.impetus.kundera.KunderaPersistence.createContainerEntityManagerFactory(KunderaPersistence.java:58) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162 ) 在 org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) 在 org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)[jboss-msc-1.0.2.GA.jar:1.0.2.GA] 在 org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)[jboss-msc-1.0.2 .GA.jar:1.0.2.GA] ... 3 更多原因:com.impetus.kundera.utils.InvalidConfigurationException:在 com.impetus.kundera 的类路径中找不到任何 META-INF/persistence.xml 文件.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130) at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86) ... 11 更多 19:17:46,590 错误 [org.jboss.msc. service.fail](MSC 服务线程 1-3)MSC00001:无法启动服务 jboss.persistenceunit。“KunderaSampleApp.war#address_mongo_pu”:org.jboss.msc.service。服务 jboss.persistenceunit 中的 StartException。“KunderaSampleApp.war#address_mongo_pu”:无法在 org.jboss.msc.service.ServiceControllerImpl$StartTask.run 启动服务(ServiceControllerImpl.java:1767)[jboss-msc-1.0.2.GA .jar:1.0.2.GA] 在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_15] 在 java.util.concurrent.ThreadPoolExecutor$Worker.run( ThreadPoolExecutor.java:908) [rt.jar:1.6.0_15] at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_15] 原因:com.impetus.kundera.loader。 PersistenceLoaderException:com.impetus.kundera.utils.InvalidConfigurationException:在 com.impetus.kundera.configure.PersistenceUnitConfiguration 的类路径中找不到任何 META-INF/persistence.xml 文件。configure(PersistenceUnitConfiguration.java:102) at com.impetus.kundera.configure.Configurator.configure(Configurator.java:63) at com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:96) at com.impetus.kundera .KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:71) at com.impetus.kundera.KunderaPersistence.createContainerEntityManagerFactory(KunderaPersistence.java:58) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) 在 org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2. GA.jar:1.0。2.GA] 在 org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] ... 3 更多作者:com.impetus.kundera.utils.InvalidConfigurationException:在 com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130) 的类路径中找不到任何 META-INF/persistence.xml 文件。 .kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86) ... 11 更多在 com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java) 的 com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130) 的类路径中找不到任何 META-INF/persistence.xml 文件:86) ... 11 更多在 com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java) 的 com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130) 的类路径中找不到任何 META-INF/persistence.xml 文件:86) ... 11 更多


它与JBoss AS5CR2.

任何指向问题的指针都会有很大帮助!

-维维克

4

1 回答 1

0

我不确定您是否可以像这样替换 JPA 实现。您可以查看https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7可能会提供一些帮助,但我不确定任何细节。

在JBoss 社区论坛中提问可能会更好。

此外,您不需要添加 commons-logging 库。只需使用<module name="org.apache.commons.logging"/>.

于 2012-07-03T20:34:19.863 回答