Search code examples
jboss7.xpersistence.xmlkundera

com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath


I am trying to deploy sample war file build using Kundera on jboss AS7.1.1.final.

Here are the steps which I have followed:

1. created a module (com.impetus.kundera), here is 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>

Copied resource root path jars under 2.0.7 folder.

  1. Modified persistence.xml for:

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

Note: My persistence.xml is under deployment/KunderaSampleApp.war/WEB-INF/classes/META-INF folder, but somehow I am getting given below error:


org.jboss.msc.service.StartException in service jboss.persistenceunit."KunderaSampleApp.war#personnel_cass_pu": Failed to start service 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] Caused by: com.impetus.kundera.loader.PersistenceLoaderException: com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath at com.impetus.kundera.configure.PersistenceUnitConfiguration.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) 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 more Caused by: com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath at com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130) at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86) ... 11 more 19:17:46,590 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."KunderaSampleApp.war#address_mongo_pu": org.jboss.msc.service.StartException in service jboss.persistenceunit."KunderaSampleApp.war#address_mongo_pu": Failed to start service 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] Caused by: com.impetus.kundera.loader.PersistenceLoaderException: com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath at com.impetus.kundera.configure.PersistenceUnitConfiguration.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) 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 more Caused by: com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath at com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130) at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86) ... 11 more


It is working absolutely fine with JBoss AS5CR2.

Any pointer to issue will be a great help!

-Vivek


Solution

  • I'm not sure you can just replace the JPA implementation like that. You can have a look at https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7 which may give some help, but I'm not sure it of any details.

    You might have better luck asking in the JBoss Comunity forums.

    Also you shouldn't need to add the commons-logging library. Just use <module name="org.apache.commons.logging"/>.