上传到beanstalk

时间:2016-01-05 17:43:13

标签: spring-mvc amazon-web-services amazon-s3 elastic-beanstalk aws-sdk

我能够将spring mvc与dynamodb一起使用,并且代码在localhost上正常工作,两个.aws文件位于根应用程序文件夹下,即在src文件夹的同一行目录上,在src / resources / .aws / credentials / AWSCredentials内.properties。以前它在beanstalk上工作正常,但突然它停止工作。我仍然可以渲染静态页面但是一旦表单提交就显示出这个错误。在创建新的beanstalk时,我的应用程序在上传到s3时显示出一些错误,但仍然会上传。请详细说明如何正确完成它。之前它在beanstalk上工作正常。

medmid.elasticbeanstalk.com 点击此页面上的箭头按钮,即提交表格将显示错误

错误

HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: AWS credential profiles file not found in the given path: /usr/share/tomcat7/.aws/credentials

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: AWS credential profiles file not found in the given path: /usr/share/tomcat7/.aws/credentials
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:981)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

1 个答案:

答案 0 :(得分:1)

2天后,所有尝试手动将文件上传到ec2实例文件夹usr/share/tomcat7/.aws/credentials我无法确切地找到为什么它无法找到我的AWSCredentails文件..但这个替代品对我有用。也可能对其他人有用

而不是写作 new ProfileCredentialsProvider()我直接编写了这段代码,因此无需映射或查找我的文件

BasicAWSCredentials credentials = new BasicAWSCredentials("your access key","your secret key"); 然后使用credentials作为参数而不是new ProfileCredentialsProvider()