问题
Ultimately, I'm trying to use AWS S3 libraries in Java code to enable server-side S3 uploads with AEM, but I'm running into problems just getting the dependencies installed and/or recognized by AEM. Every time I add a new dependency, five more issues pop up.
In this bundle I'm attempting to build, This is the error I'm seeing:
The instructions
in my pom.xml
are this:
<instructions>
<Embed-Transitive>true</Embed-Transitive>
<Export-Package>
com.amazonaws.HttpMethod,
com.amazonaws.services.s3.*
</Export-Package>
<Embed-Dependency>
gson,
aws-java-sdk-s3,
aws-java-sdk-core,
aws-java-sdk-kms,
jackson-core,
jackson-databind,
jackson-annotations,
jackson-dataformat-cbor,
ion-java,
httpclient,
brooklyn-karaf-httpcomponents-extension
</Embed-Dependency>
</instructions>
I did some googling and found this: https://mvnrepository.com/artifact/org.apache.brooklyn/brooklyn-karaf-httpcomponents-extension/0.11.0-20170403.1534
I thought that this dependency would fix my problem, so I put it into my list of dependencies, but the package still shows up in red.
All of my dependencies:
<dependencies>
<!-- OSGi Dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<!-- Other Dependencies -->
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>aem-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.api</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.115</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-core -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.115</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-kms -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-kms</artifactId>
<version>1.11.115</version>
</dependency>
<!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/software.amazon.ion/ion-java -->
<dependency>
<groupId>software.amazon.ion</groupId>
<artifactId>ion-java</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.brooklyn/brooklyn-karaf-httpcomponents-extension -->
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-karaf-httpcomponents-extension</artifactId>
<version>0.11.0-20170403.1534</version>
</dependency>
</dependencies>
回答1:
The easiest way to install AWS dependencies in your AEM instance is to use the official AEM Oak S3 connector which is available from Adobe's public repository. This is also assuming that you are not using S3 datastore in your instance otherwise all of these files and Jars would already be there. For the sake of this answer, I'll refer to v1.4.8. You can see more details on installing and configuring S3 datastore over here however, this answer is not focusing on S3 data store configuration, it's just there to provide all the libraries in your instance.
This approach is recommended as it keeps your AEM instance compatible with Adobe's AEM official hotfixes and service packs which normally use older versions of AWS SDK as compared to ones available from AWS Developer site.
To install the AWS S3 libraries, do the following steps:
- Download the latest com.adobe.granite.oak.s3connector-.zip from the repository.
- Unpack the zip into a temporary folder.
- From your temporary folder, copy all the files under
jcr_root/libs/system/install
to `crx-quickstart/install' folder. You should see some folders named as 1,5,15. If you examine these, they contain several jar files including the AWS SDK. - DO NOT copy the config files as they will setup your AEM instance to connect to S3 data store which is NOT what you want at this stage.
- Start/restart your instance and wait for it to complete.
To verify that you have all the files:
- Goto /system/console/bundles.
- Check that
AWS SDK For Java for OSGicom.amazonaws.aws-java-sdk-osgi
is active. - Click on this bundle and see all the imports and exports which will include the libraries you need for your code to work.
Following this approach ensures that your existing datastore is preserved and AEM compatible AWS SDK is properly installed in your system.
回答2:
it is dependency issue with your "httpclient" dependency.. you should try lower version of httpclient.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
use : 4.5.2 or below, and do not use any beta or redhat version
来源:https://stackoverflow.com/questions/43263479/how-do-i-resolve-org-apache-http-ssl-with-aem