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

Atharva Patel commented on JENA-556:
------------------------------------

If I add this flag to JVM -Djava.net.preferIPv4Stack=true
The exception changes to this:
Caused by: java.net.UnknownHostException: 192.168.1.100:8890
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
        at 
java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
        at java.net.InetAddress.getAllByName0(InetAddress.java:1211)
        at java.net.InetAddress.getAllByName(InetAddress.java:1127)
        at java.net.InetAddress.getAllByName(InetAddress.java:1063)
        at 
org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
        at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
        at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
        at 
org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
        at 
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:641)
        at 
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
        at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at 
org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:130)
        at 
org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:116)
        at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1011)
        at org.apache.jena.riot.web.HttpOp.execHttpGet(HttpOp.java:291)
        at org.apache.jena.riot.web.HttpOp.execHttpGet(HttpOp.java:353)
        at 
com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:326)
        ... 20 more

Notice that the hostname which it is trying search is "192.168.1.100:8890" 
where actually it should be just "192.168.1.100". I also ran a sample program 
testing this url "http://192.168.1.100:8890/sparql"; from the same machine and 
IDE and it's able to do GET method successfully.

Running the Virtuoso on port 80 and removing the port number from sparql 
endpoint (serviceURI) doesn't create an issue but limits the flexibility in 
terms of choosing the port number of our desire.

So the core issue is the port number is being merged up in the hostname lookup. 
May be accepting serviceURI as URL instead of just String typed argument in the 
constructor of classes like QueryEngineHTTP can solve the problem.

> serviceURI should allow sparql endpoints running on port other that 80
> ----------------------------------------------------------------------
>
>                 Key: JENA-556
>                 URL: https://issues.apache.org/jira/browse/JENA-556
>             Project: Apache Jena
>          Issue Type: Bug
>    Affects Versions: TDB 1.0.0
>            Reporter: Atharva Patel
>            Assignee: Andy Seaborne
>
> While trying to do simple query operation like this:
> {code:java}
> String sparqlEndpoint = "http://192.168.1.100:8890/sparql";;
> String queryString ="...";
> QueryExecution queryExecution = new QueryEngineHTTP(sparqlEndpoint, 
> queryString);
> {code}
> It gives exception like this:
> Caused by: HttpException: -1
>       at 
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:340)
>       at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:276)
>       at 
> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:346)
> Caused by: java.net.UnknownHostException: 192.168.1.100:8890: nodename nor 
> servname provided, or not known
>       at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
>       at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
>       at 
> java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
>       at java.net.InetAddress.getAllByName0(InetAddress.java:1211)
>       at java.net.InetAddress.getAllByName(InetAddress.java:1127)
>       at java.net.InetAddress.getAllByName(InetAddress.java:1063)
>       at 
> org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
>       at 
> org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
>       at 
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
>       at 
> org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
>       at 
> org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:641)
>       at 
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
>       at 
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
>       at 
> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:130)
>       at 
> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:116)
>       at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1011)
>       at org.apache.jena.riot.web.HttpOp.execHttpGet(HttpOp.java:291)
>       at org.apache.jena.riot.web.HttpOp.execHttpGet(HttpOp.java:353)
>       at 
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:326)
>       ... 20 more
> The issue seems to be the way Jena tries to parse the serviceURI internally 
> where there is likely to be a strong assumption that port number will never 
> be passed by the user of this API.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to