Maven Aws-java-sdk And Aws-android-sdk Conflict
In my maven project, I need to use aws-java-sdk-athena which has aws-java-sdk-core as a dependency. However for authentication, I have no other choices but using a provided artifact which has aws-android-sdk-core as a dependency. The problem is both of them have the com.amazonaws.http.ExecutionContext class with that exact same name. But they have different methods, etc..
I tried excluding one of them but then one of them goes off which mean those classes were used. I'm very frustrated now as it is nearly impossible to repackage one of these artifacts to change the package name in it.
<dependencies>
<!-- This dependency requires aws-java-sdk-core 1.11.292 -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-athena</artifactId>
<version>1.11.292</version>
</dependency>
<!-- This dependency requires aws-android-sdk-core 2.6.16 -->
<dependency>
<groupId>work.commons</groupId>
<artifactId>work-commons-authentication</artifactId>
<version>${authz.version}</version>
</dependency>
<dependencies>
<repositories>
<repository>
<id>in.house</id>
<name>nexus</name>
<url>http://work.name.com/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
At runtime, I got that exception:
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.amazonaws.http.ExecutionContext.setContextUserAgent(Ljava/lang/String;)
That because of both java-sdk and android-sdk have the exact class com.amazonaws.http.ExecutionContext but the class in java-sdk doesn't have setContextUserAgent method. If I change the order of dependencies, the Athena connection function broke.
Answer
Solved the problem by using a stand-alone JAR file of Athena JDBC driver. All the required classes are still there with different package name. So I didn't need to install the whole aws-java-sdk-core.
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM