Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-942

DeltaSpike fails to start with corrupted persistence.xml file.

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4.1
    • 1.5.0
    • Data-Module
    •  * Java version: 1.8.0_40, vendor: Oracle Corporation
       * Windows 7 Enterprise
       * Apache Maven 3.2.3

    Description

      Details

      Please see attached sample web application and run it via:

       mvn clean compile jetty:run 

      At startup we can see huge stack trace that tells literally nothing.

      2015-07-01 16:38:50.076:WARN:oeja.ServletContainerInitializersStarter:main:
      org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:|Exception 0 :|java.lang.RuntimeException: Failed initializing mapping files
       at org.apache.deltaspike.data.impl.meta.unit.PersistenceUnitReader.extractMappings(PersistenceUnitReader.java:82)
       at org.apache.deltaspike.data.impl.meta.unit.PersistenceUnitReader.lookupUnits(PersistenceUnitReader.java:54)
       ...
      

      Whereas the exception should look like:

       javax.servlet.ServletException: Caused by:
       javax.persistence.PersistenceException: [PersistenceUnit: netadminPU] Unable to resolve named mapping-file [META-INF/jpql/named-queries.xml]
      

      Because corruption is about pointing out to a not-existing mapping file named named-queries.xml

      Known workarounds

      1. Of course we can fix the corrupted persistence.xml file, by removing line:
        <mapping-file>META-INF/jpql/named-queries.xml</mapping-file>
      2. We can also remove dependency to "deltaspike-data" from pom.xml as it solves the issue
        Because then we got perfectly clear and correct message that tells us what is wrong with persistene.xml.

      For further details, please see file README.md inside attached application.

      BTW: Why does the DeltaSpike parse persistence.xml at application startup? Shouldn't this file be parsed with a lazy manner, at first usage of the EntityManagerFactory?

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            danielsoro Daniel Cunha
            gdemecki Grzegorz Demecki
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment