1

我复制了Java Toolkit for Rally Rest页面底部的“说明如何查询前 5 个最高优先级缺陷”的代码示例。

我相应地更改了用户名和密码,但我得到了一个UnknownHostException.

这是堆栈跟踪:

log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.BasicClientConnectionManager). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.net.UnknownHostException: rally1.rallydev.com at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849) at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1202) at java.net.InetAddress.getAllByName0(InetAddress.java:1153) at java.net.InetAddress.getAllByName(InetAddress.java:1083) at java.net.InetAddress.getAllByName(InetAddress.java:1019) 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:640) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784) at com.rallydev.rest.RallyRestApi.doRequest(RallyRestApi.java:253) at com.rallydev.rest.RallyRestApi.doGet(RallyRestApi.java:323) at com.rallydev.rest.RallyRestApi.query(RallyRestApi.java:179) at com.jdes.AgileToRally.AgileToRally.main(AgileToRally.java:37)

第 37 行:QueryResponse queryResponse = restApi.query(defects);

我试过更改服务器名称、用户名和密码,但没有运气。

谢谢

4

2 回答 2

1

查看您的堆栈跟踪,您的机器似乎正在尝试查找 IPV6 地址rally1.rallydev.com并且它失败了,因为它没有一个(然后没有回退到 IPV4)。这表明您的机器配置(或它正在使用的 DNS 服务器)存在问题,而不是 Java 中的问题。

话虽如此,您可以强制 JVM 更喜欢 IPV4,这应该可以解决您的问题:

prompt> java -Djava.net.preferIPv4Stack=true ... 

如果您使用的是 IDE,则需要将其配置为-Djava.net.preferIPv4Stack=true在运行程序时传递给 java。

于 2013-02-18T22:38:12.470 回答
1

看起来你有一个代理服务器。

restApi.setProxy(new URI(proxyserver));
于 2013-03-01T05:22:42.367 回答