17

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.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Yubaraj
  • 3,800
  • 7
  • 39
  • 57
  • Definitely there: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ClientConfigurationFactory.html – ManoDestra Apr 22 '16 at 14:28
  • @ManoDestra Yes this class is there but I checked in my dependency I did not find that's why I am asking. – Yubaraj Apr 22 '16 at 14:30
  • Yep. Just a version issue then :) – ManoDestra Apr 22 '16 at 14:31
  • 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. – Yubaraj Apr 22 '16 at 14:31
  • Well, I do not mind down voting to my question. :) – Yubaraj Apr 22 '16 at 14:32
  • 2
    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. – ManoDestra Apr 22 '16 at 14:35
  • I am checking @ManoDestra will let you know. But I just checked using 1.10.6. It did not work. I am trying with latest version. – Yubaraj Apr 22 '16 at 14:37
  • @ManoDestra Yes I was lucky previously that I did. :) – Yubaraj Apr 22 '16 at 14:47

1 Answers1

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.

Mark B
  • 183,023
  • 24
  • 297
  • 295
  • 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. – Yubaraj Apr 22 '16 at 14:25
  • 5
    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. – Mark B Apr 22 '16 at 14:31
  • Yes your comment has sense. I will check. – Yubaraj Apr 22 '16 at 14:33
  • But in which dependency this class is located? Any idea? – Yubaraj Apr 22 '16 at 14:34
  • This is the dependency that it should be including that class: `aws-java-sdk` – Mark B Apr 22 '16 at 14:39
  • I found only `ClientConfiguration.java` inside `aws-java-sdk` so asked. Thanks I will check. – Yubaraj Apr 22 '16 at 14:41
  • No you are wrong :) This class is inside `aws-java-sdk-core` . :P – Yubaraj Apr 22 '16 at 14:43
  • Well, it worked and my conclusion is I was lucky it worked before like @ManoDestra said in my question's comment. Thank yo man. Will accept later. – Yubaraj Apr 22 '16 at 14:46