我想通过驼峰在http://anyPublicWebsite.url.com拨打其他API。此连接需要通过网络配置代理主机。我已经按如下方式配置了camelContext:
public class CamelTester {
static {
camelContext = new DefaultCamelContext();
camelContext.getProperties().put("http.proxyAuthMethod", "Basic");
camelContext.getProperties().put("http.proxyAuthUsername", "usernameForproxy");
camelContext.getProperties().put("http.proxyAuthPassword", "passwordforProxy");
camelContext.getProperties().put("http.proxyHost", "myProxyHostUrl.com");
camelContext.getProperties().put("http.proxyPort", "8080");
try {
camelContext.addRoutes(new SpringRouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:starthttp").to("http://anyPublicWebsite.url.com").end();
}
});
camelContext.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
然后通过
访问它camelContext.createProducerTemplate().sendBody("direct:starthttp", ExchangePattern.InOut,"");
启动此程序时,发生了下面提到的错误
Aug 23, 2017 4:50:38 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: ntlm authentication scheme selected
Aug 23, 2017 4:50:38 PM org.apache.commons.httpclient.HttpMethodDirector processProxyAuthChallenge
INFO: No credentials available for NTLM <any realm>@myProxyHostUrl.com:8080
我想知道为什么camel无法捕获为proxyAuth提供的用户名和密码?
*注意:这些代理设置适用于其他地方,如cmd,eclipse IDE,maven设置等。