Skip to content

Error: Could not initialize class com.amazonaws.partitions.PartitionsLoader #1359

@OiAna

Description

@OiAna

Hello guys, how are you?

I am trying to use AmazonS3 Client and AmazonSNS but without success every time I have the following errors:
"java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.enable([Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/databind/ObjectMapper;
" or "org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.partitions.PartitionsLoader".

I already researched and everywhere says that problem is in the version of "jackson-core" etc. I already tried everything and even then I could not, could anyone help me?

Below is my pom.xml.

`

<modelVersion>4.0.0</modelVersion>
<groupId>com.test.api</groupId>
<artifactId>test.api</artifactId>
<version>1.0.25.1</version>
<packaging>war</packaging>
<name>test.api</name>

<properties>
	<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.6.1</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
				<compilerArguments>
					<endorseddirs>${endorsed.dir}</endorseddirs>
				</compilerArguments>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-war-plugin</artifactId>
			<version>3.1.0</version>
			<configuration>
				<failOnMissingWebXml>false</failOnMissingWebXml>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-dependency-plugin</artifactId>
			<version>3.0.1</version>
			<executions>
				<execution>
					<phase>validate</phase>
					<goals>
						<goal>copy</goal>
					</goals>
					<configuration>
						<outputDirectory>${endorsed.dir}</outputDirectory>
						<silent>true</silent>
						<artifactItems>
							<artifactItem>
								<groupId>javax</groupId>
								<artifactId>javaee-endorsed-api</artifactId>
								<version>6.0</version>
								<type>jar</type>
							</artifactItem>
						</artifactItems>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>com.amazonaws</groupId>
			<artifactId>aws-java-sdk-bom</artifactId>
			<version>1.11.106</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>


<dependencies>
	<dependency>
		<groupId>org.glassfish.jersey.core</groupId>
		<artifactId>jersey-client</artifactId>
		<version>2.25</version>
	</dependency>
	<dependency>
		<groupId>org.glassfish.jersey.media</groupId>
		<artifactId>jersey-media-multipart</artifactId>
		<version>2.25</version>
		<type>jar</type>
	</dependency>
	<dependency>
		<groupId>com.thetransactioncompany</groupId>
		<artifactId>cors-filter</artifactId>
		<version>2.6</version>
	</dependency>
	<dependency>
		<groupId>javax.mail</groupId>
		<artifactId>javax.mail-api</artifactId>
		<version>1.6.0</version>
	</dependency>
	<dependency>
		<groupId>javax.mail</groupId>
		<artifactId>mail</artifactId>
		<version>1.4.7</version>
	</dependency>
	<dependency>
		<groupId>javax.ws.rs</groupId>
		<artifactId>javax.ws.rs-api</artifactId>
		<version>2.0.1</version>
	</dependency>
	<dependency>
		<groupId>javax</groupId>
		<artifactId>javaee-web-api</artifactId>
		<version>7.0</version>
		<type>jar</type>
	</dependency>
	<dependency>
		<groupId>org.hibernate.javax.persistence</groupId>
		<artifactId>hibernate-jpa-2.1-api</artifactId>
		<version>1.0.0.Final</version>
	</dependency>
	<dependency>
		<groupId>org.json</groupId>
		<artifactId>json</artifactId>
		<version>20170516</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.persistence</groupId>
		<artifactId>eclipselink</artifactId>
		<version>2.6.4</version>
	</dependency>
	<dependency>
		<groupId>org.apache.commons</groupId>
		<artifactId>commons-email</artifactId>
		<version>1.4</version>
	</dependency>


	<dependency>
		<groupId>org.postgresql</groupId>
		<artifactId>postgresql</artifactId>
		<version>9.4.1208.jre7</version>
	</dependency>

	<dependency>
		<groupId>com.google.code.gson</groupId>
		<artifactId>gson</artifactId>
		<version>2.6.2</version>
	</dependency>

	<dependency>
		<groupId>com.sun.xml.security</groupId>
		<artifactId>xml-security-impl</artifactId>
		<version>1.0</version>
	</dependency>

	<dependency>
		<groupId>org.apache.commons</groupId>
		<artifactId>commons-lang3</artifactId>
		<version>3.6</version>
	</dependency>

	<dependency>
		<groupId>com.google.apis</groupId>
		<artifactId>google-api-services-calendar</artifactId>
		<version>v3-rev262-1.23.0</version>
		<exclusions>
			<exclusion>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-core</artifactId>
			</exclusion>
		</exclusions>
	</dependency>


	<dependency>
		<groupId>com.amazonaws</groupId>
		<artifactId>aws-java-sdk-core</artifactId>
		<exclusions>
			<exclusion>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-core</artifactId>
			</exclusion>
			<exclusion>
				<groupId>commons-logging</groupId>
				<artifactId>commons-logging</artifactId>
			</exclusion>
			<exclusion>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-annotations</artifactId>
			</exclusion>
			<exclusion>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-databind</artifactId>
			</exclusion>
			<exclusion>
				<groupId>com.fasterxml.jackson.dataformat</groupId>
				<artifactId>jackson-dataformat-cbor</artifactId>
			</exclusion>
		</exclusions>
	</dependency>

	<dependency>
		<groupId>com.amazonaws</groupId>
		<artifactId>aws-java-sdk-sns</artifactId>
		<exclusions>
			<exclusion>
				<groupId>com.amazonaws</groupId>
				<artifactId>jmespath-java</artifactId>
			</exclusion>
			<exclusion>
				<groupId>com.amazonaws</groupId>
				<artifactId>aws-java-sdk-core</artifactId>
			</exclusion>
		</exclusions>
	</dependency>

	<dependency>
		<groupId>com.amazonaws</groupId>
		<artifactId>aws-java-sdk-s3</artifactId>
		<exclusions>
			<exclusion>
				<groupId>com.amazonaws</groupId>
				<artifactId>jmespath-java</artifactId>
			</exclusion>
			<exclusion>
				<groupId>com.amazonaws</groupId>
				<artifactId>aws-java-sdk-core</artifactId>
			</exclusion>
		</exclusions>
	</dependency>

	<dependency>
		<groupId>commons-logging</groupId>
		<artifactId>commons-logging-api</artifactId>
		<version>1.1</version>
	</dependency>
	
	<dependency>
		<groupId>com.fasterxml.jackson.core</groupId>
		<artifactId>jackson-core</artifactId>
		<version>2.6.7</version>
	</dependency>
	
</dependencies>

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions