com.impetus.kundera.utils.InvalidConfigurationException:在类路径中找不到任何META-INF / persistence.xml文件

时间:2012-07-03 18:50:37

标签: jboss7.x persistence.xml kundera

我正在尝试使用Kundera on jboss AS7.1.1.final部署示例war文件构建。

以下是我遵循的步骤:

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文件夹下复制资源根路径jar。

  1. 修改后的persistence.xml:
  2.   

    &lt; property name =&#34; jboss.as.jpa.providerModule&#34;   值=&#34; com.impetus.kundera:2.0.7&#34; /&GT;

    注意:我的persistence.xml位于deployment/KunderaSampleApp.war/WEB-INF/classes/META-INF文件夹下,但不知怎的,我收到以下错误:


      服务中的

    org.jboss.msc.service.StartException   jboss.persistenceunit。&#34; KunderaSampleApp.war#personnel_cass_pu&#34;:失败   开始服务             at org.jboss.msc.service.ServiceControllerImpl $ StartTask.run(ServiceControllerImpl.java:1767)   [JBoss的-MSC-1.0.2.GA.jar:1.0.2.GA]             at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886)   [rt.jar中:1.6.0_15]             at 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:不能   在类路径中找到任何META-INF / persistence.xml文件             在com.impetus.kundera.configure.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)             在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)             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]             ... 3更多引起:com.impetus.kundera.utils.InvalidConfigurationException:无法   在类路径中找到任何META-INF / persistence.xml文件             在com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130)             在com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86)             ......还有11个       19:17:46,590 ERROR [org.jboss.msc.service.fail](MSC服务主题1-3)MSC00001:无法启动服务   jboss.persistenceunit&#34;#KunderaSampleApp.war address_mongo_pu&#34 ;:   服务中的org.jboss.msc.service.StartException   jboss.persistenceunit。&#34; KunderaSampleApp.war#address_mongo_pu&#34;:失败   开始服务             at org.jboss.msc.service.ServiceControllerImpl $ StartTask.run(ServiceControllerImpl.java:1767)   [JBoss的-MSC-1.0.2.GA.jar:1.0.2.GA]             at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886)   [rt.jar中:1.6.0_15]             at 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:不能   在类路径中找到任何META-INF / persistence.xml文件             在com.impetus.kundera.configure.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)             在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)             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]             ... 3更多引起:com.impetus.kundera.utils.InvalidConfigurationException:无法   在类路径中找到任何META-INF / persistence.xml文件             在com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130)             在com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86)             ......还有11个


    JBoss AS5CR2完全正常。

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

    -Vivek

1 个答案:

答案 0 :(得分:0)

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

你可能会在JBoss Comunity forums中提出更好的运气。

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