openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman Zulauf (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-1688) PersistenceMetaDataFactory does not recorgnize http://java.sun.com/xml/ns/persistence Namespace and throws Exception
Date Wed, 09 Jun 2010 10:33:12 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-1688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Roman Zulauf updated OPENJPA-1688:
----------------------------------

    Attachment: orm.xml
                orm_2.xml

Files that create Exception if put in META-INF and there is no internet access.

> PersistenceMetaDataFactory does not recorgnize http://java.sun.com/xml/ns/persistence
Namespace and throws Exception
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1688
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1688
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Roman Zulauf
>         Attachments: orm.xml, orm_2.xml
>
>
> I have a Java project with a persistence.xml and an orm.xml in the META-INF folder. Both
persistence.xml and orm.xml files contain JPA Persistence Meta-Data. OpenJPA can correctly
parse my persistence.xml but it needs network access to parse the orm.xml because of the schema
location specified as xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd".
When parsing persistence.xml OpenJPA does not access the network to retrieve the specified
schema.
> The exception thrown is:
> Caused by: <openjpa-2.0.0-r422266:935683 nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
org.xml.sax.SAXException: jar:file:/C:/WMPS/wmcc.jar!/META-INF/orm.xml [Location: Line: 6,
C: 19]: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'persistence'.
>         at org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceMetaDataFactory.java:295)
>         at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:228)
>         at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:554)
>         at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:374)
>         at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:358)
>         at org.apache.openjpa.meta.MetaDataRepository.resolveAll(MetaDataRepository.java:1923)
>         at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaDataInternal(MetaDataRepository.java:1901)
>         at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaData(MetaDataRepository.java:1888)
>         at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1012)
>         at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1005)
> If I remove the schema location from the orm.xml file, another exception is thrown:
> 9125  wmps  WARN   [main] openjpa.Enhance - An exception was thrown while attempting
to perform class file transformation on "ch/wiegand/appl/wmm/wmcc/model/article/Price":
> <openjpa-2.0.0-r422266:935683 nonfatal general error> org.apache.openjpa.util.GeneralException:
org.xml.sax.SAXException: file:/Q:/proj/wiegand/MMCC/bin/META-INF/orm.xml [Location: Line:
4, C: 19]: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element
'persistence'.
> 	at org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceMetaDataFactory.java:295)
> 	at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:228)
> 	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:554)
> 	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:374)
> 	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:358)
> 	at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:256)
> 	at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:227)
> 	at org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransformer.java:139)
> 	at org.apache.openjpa.enhance.PCClassFileTransformer.transform(PCClassFileTransformer.java:120)
> 	at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
> 	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
> 	at java.lang.ClassLoader.defineClass1(Native Method)
> 	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
> 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
> 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
> 	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:247)
> 	at org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1525)
> 	at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1501)
> 	at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1479)
> 	at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:272)
> 	at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)
> 	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:202)
> 	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
> 	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:213)
> 	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:151)
> 	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:57)
> 	at ch.wiegand.appl.wmm.wmcc.persistence.PersistenceManager.<init>(PersistenceManager.java:48)
> 	at ch.wiegand.appl.wmm.wmcc.persistence.PersistenceManagerFactory.createPersistenceManager(PersistenceManagerFactory.java:25)
> 	at ch.wiegand.appl.wmm.wmps.manager.PrepStationManager.<init>(PrepStationManager.java:61)
> 	at ch.wiegand.appl.wmm.wmps.facade.cli.PrepStationApp.setup(PrepStationApp.java:62)
> 	at ch.wiegand.appl.wmm.wmps.facade.cli.PrepStationApp.main(PrepStationApp.java:90)
> Caused by: java.io.IOException: org.xml.sax.SAXException: file:/Q:/proj/wiegand/MMCC/bin/META-INF/orm.xml
[Location: Line: 4, C: 19]: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
of element 'persistence'.
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:396)
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:334)
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:311)
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:284)
> 	at org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.parse(XMLPersistenceMetaDataParser.java:364)
> 	at org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceMetaDataFactory.java:293)
> 	... 39 more
> Caused by: org.xml.sax.SAXException: file:/Q:/proj/wiegand/MMCC/bin/META-INF/orm.xml
[Location: Line: 4, C: 19]: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
of element 'persistence'.
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.getException(XMLMetaDataParser.java:675)
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.error(XMLMetaDataParser.java:434)
> 	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
> 	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
> 	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
> 	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1915)
> 	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.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(AbstractSAXParser.java:1205)
> 	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:393)
> 	... 44 more
> Because the used Parser factory is not under the control of the application, there seems
to be no way to set the schema location programmatically. If there is way, it seems to be
missing in the documentation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message