[
https://issues.apache.org/jira/browse/CLEREZZA-724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13577197#comment-13577197
]
Greg Holmberg commented on CLEREZZA-724:
----------------------------------------
I think this also causes this symptom:
java.lang.LinkageError: loader constraint violation in interface itable
initialization: when resolving method
"org.apache.xerces.dom.ElementImpl.getSchemaTypeInfo()Lorg/w3c/dom/TypeInfo;"
the class loader (instance of org/apache/uima/internal/util/UIMAClassLoader) of
the current class, org/apache/xerces/dom/ElementImpl, and the class loader
(instance of <bootloader>) for interface org/w3c/dom/Element have different
Class objects for the type org/w3c/dom/TypeInfo used in the signature
at org.apache.xerces.dom.DeferredDocumentImpl.getNodeObject(Unknown
Source)
at
org.apache.xerces.dom.DeferredDocumentImpl.synchronizeChildren(Unknown Source)
at org.apache.xerces.dom.CoreDocumentImpl.getDocumentElement(Unknown
Source)
at java.util.XMLUtils.load(XMLUtils.java:58)
at java.util.Properties.loadFromXML(Properties.java:852)
at com.hp.hpl.jena.util.Metadata.read(Metadata.java:67)
at com.hp.hpl.jena.util.Metadata.addMetadata(Metadata.java:41)
at com.hp.hpl.jena.util.Metadata.<init>(Metadata.java:35)
at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:25)
at
com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.<clinit>(RDFReaderFImpl.java:85)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:42)
at
com.hp.hpl.jena.rdf.model.ModelFactory.createModelForGraph(ModelFactory.java:146)
at
org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider.serialize(JenaSerializerProvider.java:58)
at
org.apache.clerezza.rdf.core.serializedform.Serializer.serialize(Serializer.java:144)
This happened when I did this before calling the above:
Thread.currentThread().setContextClassLoader(uimaClassLoader);
which was necessary in order to find classes there weren't on the command-line
(-cp), but only known to the uimaClassLoader (i.e., classes added after JVM
startup).
For example, in my case, the clerezza.rd.core and rdf.jena.serializer Jars are
only known to the uimaClassLoader, so if I don't setContextClassLoader, then I
get:
org.apache.clerezza.rdf.core.serializedform.UnsupportedSerializationFormatException:
No serializer available for application/rdf+xml
at
org.apache.clerezza.rdf.core.serializedform.Serializer.serialize(Serializer.java:142)
Presumably because it can't find the rdf.jena.serializer Jar in the boot
classloader.
However, if I do add the setContextClassLoader line, then I get the
LinkageError with Xerces.
> Remove internally used "org.apache.xerces.util" from bundle
> import-package/export-package
> -----------------------------------------------------------------------------------------
>
> Key: CLEREZZA-724
> URL: https://issues.apache.org/jira/browse/CLEREZZA-724
> Project: Clerezza
> Issue Type: Bug
> Components: rdf.parse
> Affects Versions: 0.2-incubating
> Reporter: Minto van der Sluis
> Attachments: Issue-724.patch
>
>
> I am experiencing LinkageError when using Clerezza in combination with CXF.
> Caused by: java.lang.LinkageError: loader constraint violation: when
> resolving method
> "org.apache.xerces.util.ParserConfigurationSettings.<init>(Lorg/apache/xerces/xni/parser/XMLComponentManager;)V"
> the class loader (instance of
> org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of
> the current class, org/apache/xerces/parsers/BasicParserConfiguration,
> and the class loader (instance of
> org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for
> resolved class, org/apache/xerces/util/ParserConfigurationSettings, have
> different Class objects for the type
> gs.<init>(Lorg/apache/xerces/xni/parser/XMLComponentManager;)V used in
> the signature
> at org.apache.xerces.parsers.BasicParserConfiguration.<init>(Unknown
> Source)
> at org.apache.xerces.parsers.DTDConfiguration.<init>(Unknown Source)
> at
> org.apache.xerces.parsers.StandardParserConfiguration.<init>(Unknown Source)
> at
> org.apache.xerces.parsers.StandardParserConfiguration.<init>(Unknown Source)
> at
> com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.create(RDFXMLParser.java:117)
> at com.hp.hpl.jena.rdf.arp.JenaReader.<init>(JenaReader.java:62)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)[:1.7.0_02]
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_02]
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_02]
> at
> java.lang.reflect.Constructor.newInstance(Constructor.java:525)[:1.7.0_02]
> at java.lang.Class.newInstance0(Class.java:372)[:1.7.0_02]
> at java.lang.Class.newInstance(Class.java:325)[:1.7.0_02]
> at
> com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.getReader(RDFReaderFImpl.java:113)
> at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:226)
> at
> org.apache.clerezza.rdf.jena.parser.JenaParserProvider.parse(JenaParserProvider.java:68)
> ...
> Removing "org.apache.xerces.util" from the bundle import-package and
> export-package resuls in expected operation. Since the Xerces library is
> embedded inside the bundle it needs not to be exported.
> See also the mailing list:
> http://mail-archives.apache.org/mod_mbox/incubator-clerezza-dev/201212.mbox/%3C50C0B4BB.3030307%40xup.nl%3E
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira