4 Replies Latest reply on Aug 3, 2011 11:35 AM by Alex Ander

    Failed to start service jboss.persistenceunit inside EAR

    Alex Ander Newbie

      Hi @ll,

       

      after spending many hours and reading forums, I hope for your help:

       

      I have persistence a module, let say persistence-module.jar

       

      persistance.xml inside META-INF

       

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.0"

         xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="

              http://java.sun.com/xml/ns/persistence

              http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

                <persistence-unit name="myUnit">

                          <jta-data-source>java:/myUnit.dbsource</jta-data-source>

                </persistence-unit>

      </persistence>

       

      A class AccountDb.java

       

      @Entity

      @Table(name = "ACCOUNT")

      public class AccountDb{...}

       

       

      Now the problem

       

      1.

      If I deploy the module.jar inside WAR file, the deployment works fine! I can also persist

      the Entity using EnitiyManager.

       

      2.

      If I deploy the module.jar inside EAR file (the persistence-module.jar is in the root of EAR), the deployment fail with:

      ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit

      Caused by: java.lang.ClassNotFoundException: com.model.AccountDb from [Module "deployment.module.ear.persistence-module.jar:main" from Service Module Loader]

       

      But the class is inside the jar file, this must be a class loading problem.

      After reading this article: https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

       

      a.) I tried to add a dependency to META-INF/MANIFEST.MF

       

      Manifest-Version: 1.0

      Class-Path:

      Dependencies: deployment.module.ear.persistence-module.jar export

       

      b.) I also tried to disable isolated deployment:

      <subsystem xmlns="urn:jboss:domain:ee:1.0" >           

        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

      </subsystem>

       

      c.) I put beans.xml into META-INF of the persistence-module.jar

       

      META-INF/application.xml (generated by maven EAR plugin v2.6) of EAR looks like:

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE application PUBLIC

                "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"

                "http://java.sun.com/dtd/application_1_3.dtd">

      <application>

        <display-name>module</display-name>

        <description></description>

        <module>

          <ejb>persistence-model.jar</ejb>

        </module>

      </application>

       

      But still the same error occur

       

      What do I wrong in case 2?

       

      many thx

      alex