Issue Details (XML | Word | Printable)

Key: NUCENHANCER-69
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Critical Critical
Assignee: Unassigned
Reporter: FireSign
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
DataNucleus Enhancer (ARCHIVED)

java.lang.RuntimeException: Unknown tag : "entity-mappings"

Created: 26/Mar/11 06:55 PM   Updated: 01/Apr/11 03:27 PM   Resolved: 26/Mar/11 07:08 PM
Component/s: ASM Enhancer
Affects Version/s: 3.0.0.m1
Fix Version/s: None

Datastore: Apache Derby
Severity: Proof of Concept


 Description  « Hide
Enhancer throws Exception during parsing an orm.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
    version="1.0">

...

</entity-mappings>

Maven Plugin configuration:

<plugins>
      <plugin>
        <groupId>org.datanucleus</groupId>
        <artifactId>maven-datanucleus-plugin</artifactId>
        <version>${datanucleus.maven.plugin}</version>
        <configuration>
          <mappingIncludes>**/*.jdo, **/*.class</mappingIncludes>
          <persistenceUnitName>product-catalog</persistenceUnitName>
          <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
          <verbose>true</verbose>
          <enhancerName>ASM</enhancerName>
          <props>${basedir}/datanucleus.properties</props>
        </configuration>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

The Exception:

SEVERE: Parser error with file "file:/C:/eclipse35/workspace/datanucleus-test
/target/classes/META-INF/orm.xml" has cause Unknown tag : "entity-mappings"
java.lang.RuntimeException: Unknown tag : "entity-mappings"
        at org.datanucleus.api.jdo.metadata.JDOMetaDataHandler.startElement(JDOM
etaDataHandler.java:866)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startEle
ment(AbstractSAXParser.java:501)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElem
ent(XMLDTDValidator.java:767)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Conten
tDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1318)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Prolog
Driver.next(XMLDocumentScannerImpl.java:922)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(X
MLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:808)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
java:119)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
stractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(SAXParserImpl.java:522)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
        at org.datanucleus.metadata.xml.MetaDataParser.parseMetaDataStream(MetaD
ataParser.java:272)
        at org.datanucleus.metadata.xml.MetaDataParser.parseMetaDataURL(MetaData
Parser.java:131)
        at org.datanucleus.api.jdo.metadata.JDOMetaDataManager.parseFile(JDOMeta
DataManager.java:217)
        at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaData
Manager.java:815)
        at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(
DataNucleusEnhancer.java:836)
        at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhan
cer.java:568)
        at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer
.java:1305)

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 26/Mar/11 07:08 PM
If user requests enhancer to use JDO metadata then it expects JDO metadata and it is users fault if it can't find JPA metadata. Read the docs

FireSign added a comment - 26/Mar/11 11:25 PM
Funny.

It's not really advertised on citylights, that the maven plugin enhances the classes for JDO by default.
Strangely enough, this default configuration copes well with JPA-annotated entities, however kicks off the above exception for metadata-configured persistence units.

The maven plugin configuration defined at http://www.datanucleus.org/products/accessplatform_3_0/guides/maven2/index.html therefore only suitable for JDO projects. This in not indicated though.

So the proper solution for my case is to add <api>JPA</api> to the maven plugin configuration.