- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
所以我的下一个问题是这段代码。似乎找不到方法,我的眼睛也没有受过训练。在这方面有什么帮助吗?
package packeging;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.amazonaws.HttpMethod;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.auth.BasicAWSCredentials;
import org.apache.http.*;
/**
* Servlet implementation class Hashtastic
*/
@WebServlet("/Hashtastic")
public class Hashtastic extends HttpServlet {
private static final long serialVersionUID = 1L;
private final static String BUCKET_NAME = "idlatestingbucket";//http://s3.amazonaws.com/THESISDB/techy.jpg
private final static String FILE_NAME = "TestPicture/wallpaper-264411.png";
private final static String ACCESS_KEY = "Fakepass";
private final static String SECRET_KEY = "Fakekey";
/**
* Default constructor.
*/
public Hashtastic() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
PrintWriter out = response.getWriter();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 1000);
Date expDate = cal.getTime();
out.println(expDate+"\n");
BasicAWSCredentials cre = new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY);
AmazonS3 s3 = new AmazonS3Client(cre);
String url = s3.generatePresignedUrl(BUCKET_NAME, FILE_NAME, expDate, HttpMethod.GET).toString();
out.println(url);
out.close();
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
我收到这个 500 错误。它说它缺少一种方法。我的库中有 jar 和用于 eclipse 的插件。
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoSuchMethodError: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: method <init>()V not found
com.amazonaws.http.ConnectionManagerFactory.createThreadSafeClientConnManager(ConnectionManagerFactory.java:26)
com.amazonaws.http.HttpClientFactory.createHttpClient(HttpClientFactory.java:83)
com.amazonaws.http.AmazonHttpClient.<init>(AmazonHttpClient.java:116)
com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:60)
com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:291)
com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:273)
packeging.Hashtastic.doGet(Hashtastic.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.
有什么帮助吗?
最佳答案
如果您的类路径中有错误版本的 httpclient jar,或者如果您的类路径中有该 jar 的多个版本(例如,同时具有 httpclient-4.0.1.jar 和 httpclient-4.1. 1. jar )。
它也可能是由另一个包含同一类的不同版本的 jar 引起的。例如,我知道 gwt-dev.jar 包含一个版本的 ThreadSafeClientConnManager。如果是这种情况,可以通过调整构建路径顺序将 httpclient.jar 放在 gwt-dev.jar(或其他导致问题的 jar)之前来解决问题。
关于java - 找不到亚马逊凭据方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11103325/
我有一个问题,我不断收到错误 没有为“svn.ssl.server”凭据注册的提供者 我正在使用在另一台 SVN 服务器上工作的相同代码,但我设置的新服务器似乎无法连接,即使我可以通过 Web 浏览器
如何通过 shell 在 Hudson 中输入 subversion 凭据? 我尝试在 HUDSON_HOME 中生成文件 hudson.scm.SubversionSCM.xml 并重新加载配置,但
我正在尝试使用 powershell 访问远程注册表,如下所示: $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachi
我需要将凭据存储在 powershell 中以便多次使用。 StackOverflow 上有很多例子,所以我拿了一个 $tmpCred = Get-Credential $tmpCred.Passwo
我遇到了 youtube java 凭据的问题,通常它运行良好并且我能够上传到 youtube,但今天我收到此异常无效的凭据。 YouTubeService service = new YouTube
我正在阅读中提供的 Hadoop 凭证文档 https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/Crede
我想知道在为 MySQL 凭据/主机创建变量时最佳做法或建议做什么。 define('HOST', 'localhost'); // etc.. mysql_connect(HO
我试图让 Jenkins 从 BitBucket 克隆我的 mercurial 项目。它不会,因为它说凭据有问题 - 好吧,bitbucket 拒绝 Jenkins 提供的任何内容。 我几乎 100%
这里有一百万篇关于如何使用 git 缓存凭据的帖子。但是,如果机器重新启动,它们似乎都不成立。有没有办法缓存在机器重新启动时持续的凭据? 最佳答案 是的,在 Debian 和 Ubuntu 上,您可以
我正在尝试在我的环境中为 IIS 节点使用共享配置,我想使用组托管服务帐户凭据来实现这一目标。 当我将应用程序池的凭据应用为 MyDomain\GmsaAccount$ 时,它运行良好,但是当我尝试在
我创建了一个应用程序,它充当 2 个不同 API(WebEx 和 Exchange Web 服务)和电子邮件之间的桥梁。用户向一个特殊的电子邮件地址发送日历邀请,该应用程序解析 ICS 并创建一个 W
我正在尝试将凭据从 Jenkins 迁移到另一个凭据存储。 我想从 Jenkins 商店读取凭据,并找到了这个脚本 ( https://github.com/tkrzeminski/jenkins-g
我有一个在 Windows 上运行的 Jenkins 服务器。它将用户名:密码存储在凭据插件中。这是一个定期更新密码的服务用户。 我正在寻找一种运行脚本的方法,最好是 Powershell,它将更新
我想知道如何创建 Jenkins 和 Jenkins 中运行的作业可以使用的凭据以连接到 3rd 方服务。 最佳答案 您应该指定您将使用的第 3 方服务。 以下是带有 的凭据示例bitbucket 我
我正在一个网站上工作,我们希望使用 Spring Security Kerberos 使用 Kerberos 身份验证。所以,我们不支持 NTLM。当用户发出未经身份验证的请求时,服务器将回复带有 h
如果我设置 git config --global credential.username my_username 选项,然后使用 --local 选项覆盖一个存储库,这并没有什么区别 - 它在尝试提
我正在尝试使用需要 gce_client_id 和 gce_client_secret key 的第 3 方应用程序。为了生成它们,我浏览了凭据图标并尝试创建一个 OAuth 2.0 客户端 ID。但
我在使用 Azure 时遇到身份验证问题。我有一个运行 powershell 脚本的连续构建服务器,我收到如下消息: Your Azure credentials have not been set
首先,我想说我在安全和身份验证方面的知识非常有限。 我有一个应用程序可以从 docker store 中提取和运行容器。这是一个私有(private)仓库,所以我需要传递用户名和密码,以便用户可以拉取
我使用 Google 文档中的代码(如下所示)来管理 Google 日历。 public class CalendarQuickstart { private static final Str
我是一名优秀的程序员,十分优秀!