Error in building mvn file for the sample s3 java sdk

0

I am trying to build the aws-sample-java for s3 and I am getting this error. mvn clean compile exec:java [WARNING] java.lang.reflect.InvocationTargetException at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:119) at java.lang.reflect.Method.invoke (Method.java:578) at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:297) at java.lang.Thread.run (Thread.java:1623) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make javax.crypto.SecretKey sun.security.ssl.SSLSessionImpl.getMa.sterSecret() accessible: module java.base does not "opens sun.security.ssl" to unnamed module @7a4c6ae7 at java.lang.reflect.AccessibleObject.throwInaccessibleObjectException (AccessibleObject.java:387) at java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:363) at java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:311) at java.lang.reflect.Method.checkCanSetAccessible (Method.java:201) at java.lang.reflect.Method.setAccessible (Method.java:195) at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.verifyMa.sterSecret (SdkTLSSocketFactory.java:131) at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket (SdkTLSSocketFactory.java:112) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection (DefaultClientConnectionOperator.java:178) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open (ManagedClientConnectionImpl.java:304) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect (DefaultRequestDirector.java:610) at org.apache.http.impl.client.DefaultRequestDirector.execute (DefaultRequestDirector.java:445) at org.apache.http.impl.client.AbstractHttpClient.doExecute (AbstractHttpClient.java:863) at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:57) at com.amazonaws.http.AmazonHttpClient.executeOneRequest (AmazonHttpClient.java:685) at com.amazonaws.http.AmazonHttpClient.executeHelper (AmazonHttpClient.java:460) at com.amazonaws.http.AmazonHttpClient.execute (AmazonHttpClient.java:295) at com.amazonaws.services.s3.AmazonS3Client.invoke (AmazonS3Client.java:3697) at com.amazonaws.services.s3.AmazonS3Client.createBucket (AmazonS3Client.java:788) at com.amazonaws.services.s3.AmazonS3Client.createBucket (AmazonS3Client.java:713) at com.amazonaws.samples.S3Sample.main (S3Sample.java:86) at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104) at java.lang.reflect.Method.invoke (Method.java:578) at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:297) at java.lang.Thread.run (Thread.java:1623) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.096 s [INFO] Finished at: 2023-10-13T22:55:20-07:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project aws-java-sample: An exception occured while executing the Java class. null: InvocationTargetException: Unable to make javax.crypto.SecretKey sun.security.ssl.SSLSessionImpl.getMa.sterSecret() accessible: module java.base does not "opens sun.security.ssl" to unnamed module @7a4c6ae7 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

My POM.xml file is <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>

<groupId>com.amazonaws.samples</groupId>
<artifactId>aws-java-sample</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>aws-java-sample</name>
<url>http://aws.amazon.com/sdkforjava</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk</artifactId>
        <version>1.9.6</version>
    </dependency>
</dependencies>

<build>
    <resources>
        <resource>
            <directory>${env.HOME}/.aws/</directory>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <mainClass>com.amazonaws.samples.S3Sample</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>
</project> I am inserting . in the ma.ster words to pass the amazon test.
  • Hi, please, update your question by putting the error messages as code quote like you pom: they will become readable...

asked 6 months ago97 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions