java.lang.ClassNotFoundException: com.amazonaws.ClientConfigurationFactory
Asked Answered
A

2

18

I am using aws since last 6 months and I developed application that puts batch request to firehose. It was working fine till today but when I redeployed in my local system it is saying java.lang.ClassNotFoundException: com.amazonaws.ClientConfigurationFactory. I know what this error means. But my question is why I got this exception today? I am using following dependency in my project:

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk</artifactId>
    <!--    <version>1.10.72</version> --> // I used this version today only for testing purpose
        <version>1.10.6</version>
    </dependency>
    <!-- <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-s3</artifactId>
        <version>1.10.71</version>
    </dependency> -->
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-core</artifactId>
        <version>1.10.37</version>
        <optional>false</optional>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-kinesis</artifactId>
        <version>RELEASE</version>
    </dependency>

And I searched ClientConfigurationFactory class but don't find anywhere (anywhere means in my dependency).

My question is where is this class located and why I got this error only today? Because I did not face this error in my initial development (6 months before). I have not changed any dependencies/code today. And I am not using this class in my project (I have doubt aws-sdk may have been using inside).

Note: I can not ask Do I missed any dependency? Because it was working fine before.

Please comment if you have any doubt. Thanks.

Antecedent answered 22/4, 2016 at 14:18 Comment(8)
Definitely there: docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/…Antons
@Antons Yes this class is there but I checked in my dependency I did not find that's why I am asking.Antecedent
Yep. Just a version issue then :)Antons
And my question is why I did not face this issue during my initial development? I used these version of dependencies that I am mentioned in question.Antecedent
Well, I do not mind down voting to my question. :)Antecedent
I don't think your question requires downvoting, personally. It's fine. But the issue you have here is with inconsistent versioning of your dependencies. There's no guarantee that that would ever work. I think you were just lucky previously that it did. @MarkB's answer is correct.Antons
I am checking @Antons will let you know. But I just checked using 1.10.6. It did not work. I am trying with latest version.Antecedent
@Antons Yes I was lucky previously that I did. :)Antecedent
S
24

This is most likely because you have a mismatch of AWS SDK versions you are including. You are using a combination of SDK version 1.10.6, 1.10.71, 1.10.37 and RELEASE. You are asking for trouble mixing the versions like you are doing. Change all those to the same version and your problem will likely go away.

Sawtoothed answered 22/4, 2016 at 14:21 Comment(8)
But it was working before with these versions. I used sdk version 1.10.72 today for my another project. And I thought may be my maven dependency problem/conflict so I cleared my .m2 folder and tried again but did not work.Antecedent
You realize with RELEASE as a version you are potentially pulling in a new version every time you do a build. So working previously with this mismatch of versions is no indication that it will continue to work. You need to fix your AWS SDK version dependencies to all be the same.Sawtoothed
Yes your comment has sense. I will check.Antecedent
But in which dependency this class is located? Any idea?Antecedent
This is the dependency that it should be including that class: <artifactId>aws-java-sdk</artifactId>Sawtoothed
I found only ClientConfiguration.java inside <artifactId>aws-java-sdk</artifactId> so asked. Thanks I will check.Antecedent
No you are wrong :) This class is inside <artifactId>aws-java-sdk-core</artifactId> . :PAntecedent
Well, it worked and my conclusion is I was lucky it worked before like @Antons said in my question's comment. Thank yo man. Will accept later.Antecedent
D
0

I updated the same version for aws-java-sdk-core and aws-java-sdk-secretsmanager. things got resolved.

    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-core</artifactId>
      <version>1.12.715</version>
    </dependency>
 
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-secretsmanager</artifactId>
      <version>1.12.715</version>
    </dependency>
Disseise answered 22/6 at 17:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.