[
https://issues.apache.org/jira/browse/DELTASPIKE-942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Cunha (soro) resolved DELTASPIKE-942.
--------------------------------------------
Resolution: Fixed
> DeltaSpike fails to start with corrupted persistence.xml file.
> --------------------------------------------------------------
>
> Key: DELTASPIKE-942
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-942
> Project: DeltaSpike
> Issue Type: Improvement
> Components: Data-Module
> Affects Versions: 1.4.1
> Environment: * Java version: 1.8.0_40, vendor: Oracle Corporation
> * Windows 7 Enterprise
> * Apache Maven 3.2.3
> Reporter: Grzegorz Demecki
> Assignee: Daniel Cunha (soro)
> Labels: easyfix
> Attachments: DELTASPIKE-942-bug-showcase.zip
>
>
> h4. Details
> Please see attached sample web application and run it via:
> {code} mvn clean compile jetty:run {code}
> At startup we can see huge stack trace that tells literally nothing.
> {code:java}
> 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)
> ...
> {code}
> Whereas the exception should look like:
> {code:java}
> javax.servlet.ServletException: Caused by:
> javax.persistence.PersistenceException: [PersistenceUnit: netadminPU] Unable
> to resolve named mapping-file [META-INF/jpql/named-queries.xml]
> {code}
> _Because corruption is about pointing out to a not-existing mapping file
> named {{named-queries.xml}}_
> h4. Known workarounds
> # Of course we can fix the corrupted {{persistence.xml}} file, by removing
> line:
> {{<mapping-file>META-INF/jpql/named-queries.xml</mapping-file>}}
> # 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?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)