-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoClassDefFoundError: javax/xml/bind/annotation/adapters/HexBinaryAdapter #620
Comments
I wonder why and rdf4j exception appears, since I use owlapi. Have you
tried declaring the bnodes with []? I tried both that way and using uris
and the documentation works fine. Will give it a try with the failing
ontologies. Thanks!
El vie., 25 ago. 2023 9:03 p. m., David Bowen ***@***.***>
escribió:
… Describe the bug
When using anonymous resources
<https://en.wikipedia.org/wiki/Blank_node#Anonymous_resources_in_RDF>
with generated labels
<https://github.com/RDFLib/rdflib/blob/5b024064feef17ddb7d1b923bd9da72045ac25a9/rdflib/term.py#L431>
an error is raised because the HexBinaryAdapter
<https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/annotation/adapters/HexBinaryAdapter.html>
is not available.
To Reproduce
Steps to reproduce the behavior:
1. git clone --branch v1.4.19 https://github.com/dgarijo/Widoco.git
2. docker build -t widoco-issue Widoco/
3. Create ontology.ttl using the examples below
4. docker run --rm -v "$(pwd)":/usr/local/widoco/in widoco-issue
-ontFile in/ontology.ttl
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/adapters/HexBinaryAdapter
at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createNode(AbstractRDFParser.java:464)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseNodeID(TurtleParser.java:1120)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseValue(TurtleParser.java:586)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseObject(TurtleParser.java:462)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseObjectList(TurtleParser.java:390)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parsePredicateObjectList(TurtleParser.java:385)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseTriples(TurtleParser.java:350)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:217)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:179)
at org.semanticweb.owlapi.rio.RioParserImpl.parseDocumentSource(RioParserImpl.java:186)
at org.semanticweb.owlapi.rio.RioParserImpl.parse(RioParserImpl.java:134)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:195)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.load(OWLOntologyManagerImpl.java:1105)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:1011)
at widoco.WidocoUtils.loadModelToDocument(WidocoUtils.java:70)
at widoco.gui.GuiController.<init>(GuiController.java:275)
at widoco.gui.GuiController.main(GuiController.java:528)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.adapters.HexBinaryAdapter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base
Expected behavior
Documentation should have been generated
Additional context
Note that it fails if the name starts with an n and then some hex, or
even if it's just plain hex.
A simple working ontology
prefix dcterms: <http://purl.org/dc/terms/>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix schema: <https://schema.org/>
<example> a owl:Ontology ;
rdfs:label ***@***.*** ;
dcterms:creator _:org ;
dcterms:contributor _:org .
_:org a schema:Organization ;
schema:name "Example Org" ;
schema:url <https://example.org> .
A simple failing ontology
prefix dcterms: <http://purl.org/dc/terms/>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix schema: <https://schema.org/>
<example> a owl:Ontology ;
rdfs:label ***@***.*** ;
dcterms:contributor _:n8ee89f13b89c45248946be6e748b80b4b1 ;
dcterms:creator _:n8ee89f13b89c45248946be6e748b80b4b1 .
_:n8ee89f13b89c45248946be6e748b80b4b1 a schema:Organization ;
schema:name "Example Org" ;
schema:url <https://example.org> .
—
Reply to this email directly, view it on GitHub
<#620>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALTIGQY7DHMQOYZLTDE6V3XXDZIJANCNFSM6AAAAAA364QH44>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi @dgarijo
Yes, that works fine. It's only in this strange edge case that it goes wrong which is why I thought you might be interested. Rather fortunately the error is completely reproducible using the test case which at least means you won't be trying to guess how to make it happen. As it's so small I thought it might make a nice test case to ensure it behaves nicely in the future. I wasn't sure if you would want to change the API you were using or chase the classpath fun. As you say, sometimes it's surprising what the code pulls in. ofc I've been able to work around this by stabilising my input so I don't trip over this, so feel free to take a bit of time investigating this. Thanks for getting back to me so quickly. |
BTW it looks as though the parsers that are constructed and used in owlapi, such as TurtleParser are in the rdf4j package when it's running, but I suspect you are anticipating it loading the owlapi TurtleParser. The jar certainly appears to contain them both:
I can confirm the problematic behaviour goes as far back as I believe you are getting rdf4j from a transitive dependency in owlapi:
It looks as though owlapi 5.1.18 brings it in via it's rio/pom.xml. So to me (who doesn't know Maven) that appears to suggest it's been brought in purposefully some years ago and isn't a new transitive dependency that recently started behaving differently. It also appears there's some OSGi config for rdf4j-rio-turtle but I'm not sure which parts of owlapi are wrapped in OSGi and which bits aren't. Sorry I can't be more help. |
Thanks! Possible cause in https://stackoverflow.com/questions/61177573/javax-xml-bind-cannot-be-resolved. I have to test out the solution |
Describe the bug
When using anonymous resources with generated labels an error is raised because the HexBinaryAdapter is not available.
To Reproduce
Steps to reproduce the behavior:
git clone --branch v1.4.19 https://github.com/dgarijo/Widoco.git
docker build -t widoco-issue-620 Widoco/
ontology.ttl
using the examples belowdocker run --rm -v "$(pwd)":/usr/local/widoco/in widoco-issue-620 -ontFile in/ontology.ttl
Expected behavior
Documentation should have been generated
Additional context
Note that it fails if the name starts with an
n
and then some hex, or even if it's just plain hex.A simple working ontology
A simple failing ontology
The text was updated successfully, but these errors were encountered: