Following on from this I am having a similar problem trying to use the
Jena Provider and HTTP connections via a proxy.
This time I am explictly setting proxy params using JVM -D flags:

VM params -> -Dhttp.proxyHost=www-cache.xxx.bbc.co.uk
-Dhttp.proxyPort=80
 
I receive errors as follows:

Begin read from 'http://www.w3.org/People/Berners-Lee/card#i'  Exception
in thread "main" virtuoso.jdbc3.VirtuosoException: HC001: Connection
Error in HTTP Client
        at virtuoso.jdbc3.VirtuosoResultSet.process_result(Unknown
Source)
        at virtuoso.jdbc3.VirtuosoResultSet.<init>(Unknown Source)
        at virtuoso.jdbc3.VirtuosoStatement.sendQuery(Unknown Source)
        at virtuoso.jdbc3.VirtuosoStatement.execute(Unknown Source)
        at virtuoso.jena.driver.VirtGraph.read(Unknown Source)
        at CreateAndQueryGraph.main(CreateAndQueryGraph.java:28)
com.hp.hpl.jena.shared.JenaException: rethrew:
virtuoso.jdbc3.VirtuosoException: HC001: Connection Error in HTTP Client
        at virtuoso.jena.driver.VirtGraph.read(Unknown Source)
        at CreateAndQueryGraph.main(CreateAndQueryGraph.java:28)
Caused by: virtuoso.jdbc3.VirtuosoException: HC001: Connection Error in
HTTP Client
        at virtuoso.jdbc3.VirtuosoResultSet.process_result(Unknown
Source)
        at virtuoso.jdbc3.VirtuosoResultSet.<init>(Unknown Source)
        at virtuoso.jdbc3.VirtuosoStatement.sendQuery(Unknown Source)
        at virtuoso.jdbc3.VirtuosoStatement.execute(Unknown Source)
        ... 2 more

Is there another -D flag I should be using? Or as I expect is this again
related to proxy configuration for the Virtuoso server? 
I suspect functions such as http_client etc are being utilised under the
hood?

FYI: The JAVA code used is below (example Jena code). 

It should be noted that my web browser works with the contained urls and
is configured to go via a proxy.

This is beginning to slow down my evaluation as all http access must go
through this proxy. 
The same would be true in a test/prod environment.

Thanks again for your help
Jem



import virtuoso.jena.driver.*;

public class CreateAndQueryGraph {

        /**
         * Executes a SPARQL query against a virtuoso url and prints
results.
         */
        public static void main(String[] args) {

                String url;
                if (args.length == 0)
                        url = "jdbc:virtuoso://localhost:1111";
                else
                        url = args[0];

                /* STEP 1 */
                VirtGraph graph = new VirtGraph("Example2", url, "dba",
"dba");

                /* STEP 2 */
                /* Load data to Virtuoso */
                graph.clear();

                System.out
                                .print("Begin read from
'http://www.w3.org/People/Berners-Lee/card#i'  ");
        
graph.read("http://www.w3.org/People/Berners-Lee/card#i";, "RDF/XML");
                System.out.println("\t\t\t Done.");

                System.out
                                .print("Begin read from
'http://demo.openlinksw.com/dataspace/person/demo#this'  ");
        
graph.read("http://demo.openlinksw.com/dataspace/person/demo#this";,
                                "RDF/XML");
                System.out.println("\t Done.");

                System.out
                                .print("Begin read from
'http://kidehen.idehen.net/dataspace/person/kidehen#this'  ");
        
graph.read("http://kidehen.idehen.net/dataspace/person/kidehen#this";,
                                "RDF/XML");
                System.out.println("\t Done.");

                /* STEP 3 */
                /* Select only from VirtGraph */
                Query sparql = QueryFactory
                                .create("SELECT ?s ?p ?o WHERE { ?s ?p
?o }");

                /* STEP 4 */
                VirtuosoQueryExecution vqe =
VirtuosoQueryExecutionFactory.create(
                                sparql, graph);

                ResultSet results = vqe.execSelect();
                while (results.hasNext()) {
                        QuerySolution result = results.nextSolution();
                        RDFNode graph_name = result.get("graph");
                        RDFNode s = result.get("s");
                        RDFNode p = result.get("p");
                        RDFNode o = result.get("o");
                        System.out.println(graph_name + " { " + s + " "
+ p + " " + o
                                        + " . }");
                }

                System.out.println("graph.getCount() = " +
graph.getCount());
        }
}


-----Original Message-----
From: Kingsley Idehen [mailto:kide...@openlinksw.com] 
Sent: 16 February 2009 21:09
To: Jem Rayfield
Cc: virtuoso-users@lists.sourceforge.net
Subject: Re: [Virtuoso-users] HTTP proxy

Jem Rayfield wrote:
> Yes the rdf mappers all work as expected. The only problem I have is 
> when trying to sponge content via the virtuoso proxy.
> The virtuoso proxy needs to use an internal proxy rather than trying 
> to connect directly to a URL.
>
>       So -->   curl -> localhost virtuoso -> direct connection to
> external site -> sponge -> rdf -> quad store
>
>       Should be --> curl -> localhost virtuoso -> proxy -> external
site -> 
> sponge -> rdf -> quad store
>
> It appears that virtuoso is trying to connect directly.
>   
Yes.
> My browser is configured to connect via a proxy and I need virtuoso to

> act in the same manner.
>   
Hmm.

We need to look into that scenario.

Someone will get back to you (if not me).

Kingsley
> Thanks
> Jem
>
>
>
>
>
>  
>
> -----Original Message-----
> From: Kingsley Idehen [mailto:kide...@openlinksw.com]
> Sent: 16 February 2009 16:51
> To: Jem Rayfield
> Cc: virtuoso-users@lists.sourceforge.net
> Subject: Re: [Virtuoso-users] HTTP proxy
>
> Jem Rayfield wrote:
>   
>> Hi,
>>
>> I am having problems sponging external data as my virtuoso instance 
>> is
>>     
>
>   
>> behind a SOCKs proxy.
>>
>> Thus I keep seeing results such as -->
>>
>> $ curl -H "Accept: text/xml" 
>>
>>     
> "_http://localhost:8890/about/rdf/http://www.freebase.com/view/en/bara
> ck
> _obama_" 
>   
>> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html>
>>   <head>
>>     <title>Error HTCLI</title>
>>   </head>
>>   <body>
>>     <h3>Error HTCLI</h3><pre>
>> HC001: Connection Error in HTTP Client
>>   </pre></body>
>> </html>
>>
>> How can I setup the server to use a proxy for client connections?
>>
>> Thanks for pointers
>> Jem
>>
>>   
>>     
> Have you installed the RDF_Mappers VAD package? Do this via the 
> Conductor.
>
> Kingsley
>   
>> ---------------------------------------------------------------------
>> -
>> --
>>
>> ---------------------------------------------------------------------
>> -
>> -------- Open Source Business Conference (OSBC), March 24-25, 2009, 
>> San Francisco, CA -OSBC tackles the biggest issue in open source: 
>> Open
>>     
>
>   
>> Sourcing the Enterprise -Strategies to boost innovation and cut costs

>> with open source participation -Receive a $600 discount off the 
>> registration fee with the source code: SFAD 
>> http://p.sf.net/sfu/XcvMzF8H
>> ---------------------------------------------------------------------
>> -
>> --
>>
>> _______________________________________________
>> Virtuoso-users mailing list
>> Virtuoso-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>   
>>     
>
>
>   


-- 


Regards,

Kingsley Idehen       Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO 
OpenLink Software     Web: http://www.openlinksw.com





Reply via email to