有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java amazon SDK for S3服务中的linux连接被拒绝

我正在编写一个命令行工具来管理S3服务。在我的本地计算机上,一切正常,但在应该执行它的服务器上,出现故障,并显示以下消息:

Error Message: Unable to execute HTTP request: Connection to http://s3.amazonaws.com refused

我使用以下代码进行连接:

 s3  = new AmazonS3Client(credentials,clientConf);

clientConf只将协议设置为HTTP,因为我怀疑连接到HTTPS可能会有问题,但我得到了相同的结果

现在,服务器具有以下配置:

debian 6 64位

从光源安装的灯

从源代码安装openssl

从分发包安装java

这是网络配置:

    auto eth0
iface eth0 inet static

address XX.XX.XX.XX
netmask 255.255.255.255
broadcast XX.XX.XX.XX (same as address)

auto eth0:0
iface eth0:0 inet static

address XX.XX.XX.XX
netmask 255.255.255.255
broadcast XX.XX.XX.XX (same as address)

auto eth0:1
iface eth0:1 inet static

address XX.XX.XX.XX
netmask 255.255.255.255
broadcast XX.XX.XX.XX (same as address)

post-up route add 10.255.255.1 dev eth0
post-up route add default gw 10.255.255.1

wget、telnet、curl,一切都正常,除了这个,我有3个网络接口,因为我有2个SSL和其他站点的另一个ip

我应该如何配置clientConf来实现这一点?是java问题吗?网络问题?至少,我怎样才能获得更多的调试信息?我试图捕获AmazonClientException异常,但没有成功

提前感谢:)

问候


共 (1) 个答案

  1. # 1 楼答案

    This has been reported as a bug in the Amazon S3 API。QuothZachM@AWS

    This appears to be a bug in the SDK. The problem is that the client configuration object is shared with the Security Token Service client that DynamoDB uses to establish a session, and it (unlike Dynamo) doesn't accept the HTTP protocol. There are a couple workarounds:

    1) Create your own instance of STSSessionCredentialsProvider and provide it to your DynamoDB client, or

    2) Instead of specifying the protocol in the ClientConfiguration, specify it with a call to setEndpoint("http://...")

    We'll discuss solutions for this bug.

    我建议现在使用一种变通方法。祝你的连接成功

    Additional documentation and workarounds