What are the required jar files for upload/download files from AWS S3 bucket for WEB Application. I tried with below Jar files but still not able to succeed.
aws-java-sdk-1.10.26
aws-java-sdk-1.10.26-javadoc
aws-java-sdk-1.10.26-sources
aws-java-sdk-flow-build-tools-1.10.26
apache-httpcomponents-httpcore
apache-httpcomponents-httpclient
com.fasterxml.jackson.core
jackson-databind-2.2.3
jackson-annotations-2.2.3
httpclient-4.2
Help me to add only the required JAR files. Thanks in Advance.
download the AWS Java SDK (pre packed / zip form). Include all the jars from lib and third-party.
You should get it as a maven depencendy as its MUCH easier that way, but if you have time you can also check the jar's on here:
http://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk
There is a minimum dependency list for amazon s3 sdk basic operations such as
upload or download.
The minimum dependencies are as follows:-
aws-java-sdk-1.6.7
commons-codec-1.3
commons-logging-1.1.1
httpclient-4.2.3
httpcore-4.2
jackson-databind-2.1.1
jackson-core-2.1.1
jackson-annotations-2.1.1
Note that aws-java-sdk-1.6.7 requires commons-codec-1.3.jar. If you do not include this particular version, then aws might not warn you of internal errors but would silently skip exceptions thereby giving faulty results.
Also, you should use joda-time-2.8.1.jar for authentication and aws date/time sync purposes!
In additon to these I also include apache commons-io for optimized download methods/file copy utilities etc. (It's a great combo and makes your file download work a lot easier)
Related
I have a heavy monolithic guidewire application that has both fop.jar and xmlgraphics-commons.jar.
So, I am trying to add an image into a pdf file which is supposed to get rendered with the xmlgraphics-commons.jar. This jar has about 5/6 image renderers available .
Now when I try to print this pdf, the fop jar is used to render some other text onto the pdf and for the image, the xmlgraphics-commons.jar within the fop jar is used. This particular version of the same jar has somehow just 2 image decoders and although I tried to match the format SVG/WMF, it still doesn't work. I get this 'No-ImagePreloader Found' error.This gw application works correctly in my local but when deployed to websphere, it gives this error. Maybe something because of classloader policies.
I cannot use a custom class loader as I don't have control over the code here because the java call happens internally as I am using .pcf files for pdf printing.
I examined the fop and xmlgraphics-commons jars and clearly see the difference in the Meta-Inf Services files.
What can I do to get this working ? Maybe there is a simple solution I am missing out on.
i can only work with these jars.
I checked some similar questions but they dont help me. Also this below thread might get you understand the crux of my issue better.
Apache FOP in a Java Applet - No ImagePreloader found for data
I tried updating the 'org.apache.xmlgraphics.image.loader.spi.ImageLoader' file in meta-inf/services of fop to give the implementation from my external xmlgraphics jar. Got the same error.
If this application had been a maven one, I would have simply excluded this xmlgraphics within fop and used the external one.
So, I need to download 2 csv files which include pricing details for some AWS services.
https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSStorageGateway/current/index.csv
https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonS3/current/index.csv
I need to download the files from the URLs and store it in separate folders to avoid conflicts. Such as, the first index.csv file will be downloaded to a folder AWSStorageGateway and the second one to folder AmazonS3.
Or another approach could be to store those files in 1 folder by changing filenames like AWSStorageGateway.csv and AmazonS3.csv. If the files already exist, it needs to be replaced with the new one.
The project uses Java 8 and Spring MVC. I don't want to use any external libraries. Is NIO package enough to handle this?
I am trying to download Application from GCP using this link: Downloading Your Application. But it looks like this works only for the Standard environment cos code executes without errors but nothing is actually downloaded after. Output is:
AM Host: appengine.google.com
AM Fetching file list...
AM Fetching files...
What will be the solution to achieve the same result in Flexible environment?
When you deploy an App Engine Flexible application, the source code is uploaded to Cloud Storage on your project in a bucket named staging..appspot.com. You can navigate in this bucket and download the source code for a specific version as a .tar file.
Alternatively, you can find the exact Cloud Storage URL for your source code by going to Dev Console > Container Registry > Build History and select the build for your version. You'll find the link to your source code under Build Information.
One thing to note however is that the staging... bucket is created by default with a Lifecycle rule that deletes files older than 15 days automatically. You can delete this rule if you want so that all versions' source code is kept indefinitely.
Is there an AWS Java method to upload the zip file to AWS Lambda? All examples either use CLI aws or upload via the website.
You can use the createFunction or updateFunctionCode methods of the AWSLambdaClient class to upload the zip file to Lambda using the AWS SDK for Java.
Read the following docs:
Learn how to use AWS Lambda to easily create infinitely scalable web services
Class AWSLambdaClient
Using following link you can find out how to upload your Java based function to Lambda using Maven and CLI functionalities.
Following steps will help to You
Create a project directory
create build.gradle
Handle folder structure
build and package the project in a .zip file
http://docs.aws.amazon.com/lambda/latest/dg/create-deployment-pkg-zip-java.html
I understand the question is about uploading the zip file but it can help someone else. If you are using Eclipse then you can use the aws plugin to package code and then upload as lambda function to AWS Account.
Eclipse Plugin to Upload Java Lambda Function
Plugin will ask for the following information:
credentials: which plugin can read from credentials file in .aws
directory.
role: name of role which will be assumed by lambda when executed.
bucketName: where zip file will be stored.
Other Settings such as Region, Memory etc
I am making a Java application that uses, Spring, Maven and the AWS-SDK-Java. In order to the AWS SDK to work I have to place the AWSCredentials.properties file inside the "MyProject/src/main/resources" folder.
So far so so good. Then I have to create a .war file. To do that I use mvn install command and voilá.
Now inside the .war created, the file I want to access is in the "/WEB-INF/classes/" folder and I need to read it.
How can I access this file inside the war so I can read its content? I have experimented with ServeltContext but so far nothing I try works!
It is generally not a good practice to keep credential in code package (war). Instead I would suggest you use IAM Roles.
This will make it easy for you to move your code from one AWS account to another (say dev environment to production). Since the code will be submitted to a version control system which will be accessed by many, it is also good from a security point of view to use IAM roles.
I found a way to do it. I can access the file by using:
InputStream inputStream =
getClass().getClassLoader().getResourceAsStream("/resources/email/file.txt");
As explained in this discusison:
Reading a text file in war archive