[
https://issues.apache.org/jira/browse/ARIES-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986989#action_12986989
]
Timothy Ward commented on ARIES-556:
------------------------------------
Hi David,
I'll make sure that this fix makes it into the 0.3 release.
As for why we don't use JAXB, there are a couple of reasons, firstly, we would
still need to work out which version of the JPA schema the xml file uses so
that we can schema validate. Secondly, there is actually a "bug" in the JPA 1.0
schema which means that the example xml snippets in the spec don't work
properly. By using SAX we can fix this bug to get the intended behaviour, which
isn't really possible in JAXB without rewriting the generated classes.
These issues, combined with the fact that by using SAX we can have a single
parser for both spec versions, means that SAX seemed like the better choice.
In this case the bug was actually caused by a performance optimisation - we
used a BufferedInputStream to reset the InputStream back to its start after our
first pass parse (for finding the xml version). This first parse only needs to
read the <persistence... element>, which for most SAX parsers means that you
only read the first few hundred bytes - unfortunately this doesn't apply for
all SAX parsers. We now have a fully rewindable InputStream, so there shouldn't
be any more issues.
Tim
> Aries fails to read persistence.xml files larger than 8192 bytes
> ----------------------------------------------------------------
>
> Key: ARIES-556
> URL: https://issues.apache.org/jira/browse/ARIES-556
> Project: Aries
> Issue Type: Bug
> Components: JPA
> Affects Versions: 0.2
> Reporter: David Schmitz
> Assignee: Timothy Ward
> Priority: Critical
>
> Aries fails to read persistence.xml files larger than 8192 bytes. We
> recognized this bug while we were adding new Entity classes to
> persistence.xml when we removed enough data so that we were below or equal to
> 8192 bytes everything went fine.
> This is probably caused by wrong implementation within
> org.apache.aries.jpa.container.parsing.impl.PersistenceDescriptorParserImpl
> parse method.
> If one tries to read persistence.xml files larger than 8192 the following
> exception is thrown:
> 13:52:01.492 ERROR [Start Level Event
> Dispatcher][org.apache.aries.jpa.container:331] There was an error while
> parsing the persistence descriptor META-INF/openjpa_persistence_product.xml
> in bundle com.navteq.phoenix.jpa_1.0.0. No persistence units will be managed
> for this bundle
> org.apache.aries.jpa.container.parsing.PersistenceDescriptorParserException:
> There was an error parsing META-INF/openjpa_persistence_product.xml in bundle
> com.navteq.phoenix.jpa_1.0.0
> at
> org.apache.aries.jpa.container.parsing.impl.PersistenceDescriptorParserImpl.parse(PersistenceDescriptorParserImpl.java:98)
> ~[org.apache.aries.jpa.container-0.2-incubating.jar:0.2-incubating]
> at
> org.apache.aries.jpa.container.impl.PersistenceBundleManager.parseBundle(PersistenceBundleManager.java:329)
> [org.apache.aries.jpa.container-0.2-incubating.jar:0.2-incubating]
> at
> org.apache.aries.jpa.container.impl.PersistenceBundleManager.setupManager(PersistenceBundleManager.java:350)
> [org.apache.aries.jpa.container-0.2-incubating.jar:0.2-incubating]
> at
> org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingBundle(PersistenceBundleManager.java:148)
> [org.apache.aries.jpa.container-0.2-incubating.jar:0.2-incubating]
> at
> org.apache.aries.util.tracker.InternalRecursiveBundleTracker.addingBundle(InternalRecursiveBundleTracker.java:70)
> [org.apache.aries.util-0.2-incubating.jar:0.2-incubating]
> at
> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:440)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:159)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.apache.aries.util.tracker.RecursiveBundleTracker.open(RecursiveBundleTracker.java:77)
> [org.apache.aries.util-0.2-incubating.jar:0.2-incubating]
> at
> org.apache.aries.jpa.container.impl.PersistenceBundleManager.open(PersistenceBundleManager.java:132)
> [org.apache.aries.jpa.container-0.2-incubating.jar:0.2-incubating]
> at
> org.apache.aries.jpa.container.impl.PersistenceBundleManager.start(PersistenceBundleManager.java:619)
> [org.apache.aries.jpa.container-0.2-incubating.jar:0.2-incubating]
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at java.security.AccessController.doPrivileged(Native Method)
> [na:1.6.0_22]
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> at
> org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)
> [org.eclipse.osgi_3.6.0.v20100517.jar:na]
> Caused by: java.io.IOException: Resetting to invalid mark
> at java.io.BufferedInputStream.reset(BufferedInputStream.java:416)
> ~[na:1.6.0_22]
> at
> org.apache.aries.jpa.container.parsing.impl.PersistenceDescriptorParserImpl.parse(PersistenceDescriptorParserImpl.java:90)
> ~[org.apache.aries.jpa.container-0.2-incubating.jar:0.2-incubating]
> ... 25 common frames omitted
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.