[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] The same META-INF/orm*.xml file is "found" twice when using Eclipse 3.4.1/jetty6.1.14/Eclipselink 1.1.2
|
Our META-INF/ormSim.xml file is being found twice when using a
combination of Eclipse 3.4.1, jetty6.1.14, and Eclipselink 1.1.2 as
the environment. (jetty as a non-deployed inline container for an
eclipse run configuration).
Caused by: Exception [EclipseLink-7252] (Eclipse Persistence Services
- 1.1.2.qualifier):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: There are multiple mapping files called
[META-INF/ormSim.xml] in classpath for persistence unit named [Sim ].
at org.eclipse.persistence.exceptions.ValidationException.nonUniqueMappingFileName(ValidationException.java:1242)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.loadSpecifiedMappingFiles(MetadataProcessor.java:304)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.loadMappingFiles(MetadataProcessor.java:276)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:294)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:838)
... 85 more
I rewrote jpa/org.eclipse.persistence.jpa:
org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor to
ignore the error and to log the paths found, and I find the second
mapping is identical to the first.
nextURL java.net.URL (id=5654)
otherURL java.net.URL (id=5662)
file:/home/mkienenb/workspaces/xyz/app/WEB-INF/classes/META-INF/ormSim.xml
file:/home/mkienenb/workspaces/xyz/app/WEB-INF/classes/META-INF/ormSim.xml
I noticed that James Sutherland posted an issue for this back in Nov
2006 for TopLink.
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1441
Our problem is a little different in that it's one file being found
twice rather than two separate files being found. We aren't seeing
this happen under a separate Tomcat 6 deployment, so would this mean
it is a bug in jetty?
Here's how I modified MetadataProcessor.loadSpecifiedMappingFiles to
log and work around the issue. Should I open an issue and submit this
as a patch?
Regards,
-Mike
protected void loadSpecifiedMappingFiles(boolean throwExceptionOnFail) {
PersistenceUnitInfo puInfo = m_project.getPersistenceUnitInfo();
for (String mappingFileName : puInfo.getMappingFileNames()) {
try {
Enumeration<URL> mappingFileURLs =
m_loader.getResources(mappingFileName);
if (mappingFileURLs.hasMoreElements()) {
URL nextURL = mappingFileURLs.nextElement();
if (mappingFileURLs.hasMoreElements()) {
AbstractSessionLog.getLog().log(SessionLog.WARNING, "Found and using
mapping file '" + mappingFileName + "' in " + nextURL);
while (mappingFileURLs.hasMoreElements()) {
URL otherURL = mappingFileURLs.nextElement();
AbstractSessionLog.getLog().log(SessionLog.WARNING, "Also found
mapping file '" + mappingFileName + "' in " + otherURL);
}
}
// Read the document through OX and add it to the project.
m_project.addEntityMappings(XMLEntityMappingsReader.read(nextURL,
m_loader));
} else {
handleORMException(ValidationException.mappingFileNotFound(puInfo.getPersistenceUnitName(),
mappingFileName), mappingFileName, throwExceptionOnFail);
}
} catch (IOException e) {
handleORMException(PersistenceUnitLoadingException.exceptionLoadingORMXML(mappingFileName,
e), mappingFileName, throwExceptionOnFail);
}
}
}