Java graphDB用户/PW代理设置导致状态代码407
我试图在本地graphDB实例(Windows上的graphDB Free 9.4.1)上运行以下SPARQL查询Java graphDB用户/PW代理设置导致状态代码407,java,jvm-arguments,graphdb,rdf4j,Java,Jvm Arguments,Graphdb,Rdf4j,我试图在本地graphDB实例(Windows上的graphDB Free 9.4.1)上运行以下SPARQL查询 前缀wd: 前缀wdt: 前缀rdfs: 选择*WHERE{ 服务{ ?主体wdt:P31 wd:Q744913; wdt:P625?坐标; 标签 过滤器(lang(?label)=“en”) } } 在我的个人电脑上,查询工作没有问题。 但在我的公司网络中,它没有,因为我们有一个代理 我用RDF4J Java程序检查了我的代理设置,它们工作得非常好 [...] System.s
前缀wd:
前缀wdt:
前缀rdfs:
选择*WHERE{
服务{
?主体wdt:P31 wd:Q744913;
wdt:P625?坐标;
标签
过滤器(lang(?label)=“en”)
}
}
在我的个人电脑上,查询工作没有问题。
但在我的公司网络中,它没有,因为我们有一个代理
我用RDF4J Java程序检查了我的代理设置,它们工作得非常好
[...]
System.setProperty("https.proxyHost", "<company_proxy>");
System.setProperty("https.proxyPort", "<company_proxy_port>");
System.setProperty("https.nonProxyHost", "localhost|127.0.0.1|<company_list>");
System.setProperty("https.proxyUser", "<user>");
System.setProperty("https.proxyPassword", "<password>");
[...]
[…]
System.setProperty(“https.proxyHost”,”);
System.setProperty(“https.proxyPort”,”);
System.setProperty(“https.nonProxyHost”、“localhost | 127.0.0.1 |”);
System.setProperty(“https.proxyUser”,”);
System.setProperty(“https.proxyPassword”,”);
[...]
我尝试用不同的方法为GraphDB设置相同的设置
- 通过用户界面
- 通过
配置文件C:\Users\XXXX\AppData\Local\GraphDB-Free\runtime\conf\net
- 通过
配置文件C:\Users\XXXX\AppData\Roaming\GraphDB\conf\proxy.properties
- 通过
配置文件C:\Users\XXXX\AppData\Local\GraphDB Free\app\
本问题中提到的代理配置现在可以正常工作。您可以尝试将“graphdb.workbench.external url”参数设置为实例应该驻留的url/子路径。此参数用于重写传入请求,并有助于API调用。模拟代理服务器问题的最接近可能场景是:
https.proxyUser
及其HTTP.proxyUser
等效项克服了这个问题。该示例适用于您的查询和mitmproxy服务器:
# Setup not only HTTPS but also HTTP connection
/graphdb -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8080 -Dhttps.proxyUser=testUser -Dhttps.proxyPassword=testPassword -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8080 -Dhttp.proxyUser=testUser -Dhttp.proxyPassword=testPassword
我在本地机器上运行graphDB,所以它在本地主机上运行。我的问题是无法通过代理的传出请求,因为它们缺少用户名和密码。所以我不知道应该设置什么“graphdb.workbench.external url”?graphdb不支持https.proxyUser和https.proxyPassword。您是否尝试将用户名和密码传递给远程请求?如果您想执行对远程GraphDB的请求,它在代理之后运行,后者应该通过设置“GraphDB.workbench.external url”启动。此外,您还可以使用此链接中的说明。
# ~/.mitmproxy/mitmproxy-ca-cert.cer is the certificate shipped with the proxy
sudo keytool -importcert -file ~/.mitmproxy/mitmproxy-ca-cert.cer -alias mitmproxy -keystore $JAVA_HOME/jre/lib/security/cacerts
# The proxy will require username and password
mitmproxy --set proxyauth=testUser:testPassword
# Point the Apache HTTP Client to use the mitmproxy
./graphdb -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8080 -Dhttps.proxyUser=testUser -Dhttps.proxyPassword=testPassword
# Setup not only HTTPS but also HTTP connection
/graphdb -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8080 -Dhttps.proxyUser=testUser -Dhttps.proxyPassword=testPassword -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8080 -Dhttp.proxyUser=testUser -Dhttp.proxyPassword=testPassword