You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Stian Soiland-Reyes (JIRA)" <ji...@apache.org> on 2016/05/09 12:55:12 UTC

[jira] [Commented] (JENA-1176) JSON-LD @context parsing fails due to outdated HTTPClient

    [ https://issues.apache.org/jira/browse/JENA-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15276324#comment-15276324 ] 

Stian Soiland-Reyes commented on JENA-1176:
-------------------------------------------

affects riot as well with the 3.1.0 RC2:

{code}
stain@biggie:~/Downloads/apache-jena-3.1.0$ bin/riot --syntax=jsonld
{"@context": "https://w3id.org/bundle/context",
 "id": "http://example.com/fred",
 "aggregates": "http://example.com/other"
}
^D
{code}

fails with

{code}
Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.http.impl.client.cache.CacheConfig.custom()Lorg/apache/http/impl/client/cache/CacheConfig$Builder;
    at com.github.jsonldjava.utils.JsonUtils.createDefaultHttpClient(JsonUtils.java:333)
..
{code}

> JSON-LD @context parsing fails due to outdated HTTPClient
> ---------------------------------------------------------
>
>                 Key: JENA-1176
>                 URL: https://issues.apache.org/jira/browse/JENA-1176
>             Project: Apache Jena
>          Issue Type: Bug
>            Reporter: Stian Soiland-Reyes
>            Priority: Blocker
>              Labels: httpclient, jsonld
>             Fix For: Jena 3.1.0
>
>
> Raised by [Francois|http://mail-archives.apache.org/mod_mbox/jena-dev/201605.mbox/%3CB51A2FF9-23E8-460B-913D-43BAB7A07E29%40gmail.com%3E]:
> {code}
> public class TestJsonLDReader {
> 	@Test public final void test() {
> 		String jsonld = "{\"@id\":\"_:b0\",\"@type\":\"http://schema.org/Person\",\"name\":\"John
> Doe\",\"@context\":\"http://schema.org/\"}";
> 		StringReader reader = new StringReader(jsonld);
> 		Model m = ModelFactory.createDefaultModel();
> 		m.read(reader, null, "JSON-LD");
> 		m.write(System.out, "TURTLE");
> 	}
> }
> {code}
> Fails with:
> {code}
> java.lang.NoSuchMethodError: org.apache.http.impl.client.cache.CacheConfig.custom()Lorg/apache/http/impl/client/cache/CacheConfig$Builder;
> 	at com.github.jsonldjava.utils.JsonUtils.createDefaultHttpClient(JsonUtils.java:333)
> 	at com.github.jsonldjava.utils.JsonUtils.getDefaultHttpClient(JsonUtils.java:323)
> 	at com.github.jsonldjava.core.DocumentLoader.getHttpClient(DocumentLoader.java:84)
> 	at com.github.jsonldjava.core.DocumentLoader.fromURL(DocumentLoader.java:59)
> 	at com.github.jsonldjava.core.DocumentLoader.loadDocument(DocumentLoader.java:29)
> 	at com.github.jsonldjava.core.Context.parse(Context.java:169)
> 	at com.github.jsonldjava.core.Context.parse(Context.java:252)
> 	at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:534)
> 	at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:981)
> 	at com.github.jsonldjava.core.JsonLdProcessor.expand(JsonLdProcessor.java:146)
> 	at com.github.jsonldjava.core.JsonLdProcessor.toRDF(JsonLdProcessor.java:482)
> 	at org.apache.jena.riot.lang.JsonLDReader.read$(JsonLDReader.java:143)
> 	at org.apache.jena.riot.lang.JsonLDReader.read(JsonLDReader.java:64)
> {code}
> This is caused by a newer [JSONLD-Java 0.8.2|https://github.com/jsonld-java/jsonld-java/blob/v0.8.2/pom.xml#L42] now depending on 
> {code:xml}
> 		<httpclient.version>4.5.1</httpclient.version>
> 		<httpcore.version>4.4.4</httpcore.version>
> {code} 
> while we explicitly depend on a much older version:
> {code:xml}
>     <!-- These are connected because solr4j depends on httpclient as well -->
>     <ver.httpclient>4.2.6</ver.httpclient>
>     <ver.httpcore>4.2.5</ver.httpcore>
> {code}
> Issue JENA-576 discusses why HTTPClient was not upgraded.
> I suggest we try again to upgrade HTTPClient, even if this means also a newer Solr. 
> A workaround would be to have an initialization to set JsonUtils.setDefaultClient() with our own instance - however that would break JSON-LD [Context JAR caching|https://github.com/jsonld-java/jsonld-java#loading-contexts-from-classpathjar] which I know we use in Taverna to avoid network traffic.
> As JSON-LD with external @context - e.g. with schema.org,  is the primary way to use JSON-LD, then I think this should be a blocker for 3.1.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)