j256 / cloudwatch-logback-appender

Appender that publishes logback log entries to AWS CloudWatch
ISC License
56 stars 37 forks source link

NoSuchMethodError: createLogGroup #6

Closed destebanm closed 7 years ago

destebanm commented 7 years ago

Hey!

I am trying to use your library but i am getting this error.

Exception in thread "CloudWatchAppender" java.lang.NoSuchMethodError: com.amazonaws.services.logs.AWSLogsClient.createLogGroup(Lcom/amazonaws/services/logs/model/CreateLogGroupRequest;)V
    at com.j256.cloudwatchlogbackappender.CloudWatchAppender$CloudWatchWriter.verifyLogGroupExists(CloudWatchAppender.java:505)
    at com.j256.cloudwatchlogbackappender.CloudWatchAppender$CloudWatchWriter.initialize(CloudWatchAppender.java:490)
    at com.j256.cloudwatchlogbackappender.CloudWatchAppender$CloudWatchWriter.writeEvents(CloudWatchAppender.java:402)
    at com.j256.cloudwatchlogbackappender.CloudWatchAppender$CloudWatchWriter.run(CloudWatchAppender.java:369)
    at java.lang.Thread.run(Thread.java:748)

I have included in my pom.xml

<dependency>
    <groupId>com.j256.cloudwatchlogbackappender</groupId>
    <artifactId>cloudwatchlogbackappender</artifactId>
    <version>1.8</version>
</dependency>

Before of this, because I am using the aws-sdk, I have included:

<properties>
    <project.aws>1.11.109</project.aws>
</properties>
<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk</artifactId>
    <version>${project.aws}</version>
</dependency>

Can you figure out what is happening?

Thanks!

j256 commented 7 years ago

Huh. I just ran my full integration test with that version and it works fine. I've been testing with 1.10.40 and I'd be surprised if the dropped backwards compatibility for something in the logs.

destebanm commented 7 years ago

Yes, It is really weird. I am using spring boot and taking a look to the lib folder, it is included the aws-java-sdk-log with version 1.11.109. In this version the method exists so I don´t understand what is happening

j256 commented 7 years ago

Is it possible that a different version of the AWS SDK is loading than you think? Maybe it is a dependency from somewhere else?

destebanm commented 7 years ago

Here is the same problem:

http://stackoverflow.com/a/37618972/6927039

I did what he suggests, changing version in your pom and it works.

I have just create a pull request

j256 commented 7 years ago

Hey @destebanm . Give the 1.10 version a try. I think it fixes it. I switched to making the log-group and log-stream creation using reflection which seems to have fixed the method signature issue.

destebanm commented 7 years ago

Hey @j256, i have been testing the 1.10 version and It´s working fine.

Thanks!