jenkinsci/aws-sqs-plugin

Unable to use IAM credentials, java.lang.NoClassDefFoundError

Opened this issue ยท 22 comments

We set-up IAM credentials as a Secret Text (ID=IAM Access Key, Secret = IAM access secret). We found the listener would fail with the following ERROR:

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.auth.internal.AWS4SignerUtils
	at com.amazonaws.auth.internal.AWS4SignerRequestParams.<init>(AWS4SignerRequestParams.java:99)
	at com.amazonaws.auth.AWS4Signer.sign(AWS4Signer.java:225)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1210)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
	at com.amazonaws.services.sqs.AmazonSQSClient.doInvoke(AmazonSQSClient.java:2013)
	at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:1989)
	at com.amazonaws.services.sqs.AmazonSQSClient.executeGetQueueUrl(AmazonSQSClient.java:1075)
	at com.amazonaws.services.sqs.AmazonSQSClient.getQueueUrl(AmazonSQSClient.java:1052)
	at com.amazonaws.services.sqs.AmazonSQSClient.getQueueUrl(AmazonSQSClient.java:1087)
	at io.relution.jenkins.awssqs.SQSTriggerQueue$DescriptorImpl.doValidate(SQSTriggerQueue.java:481)
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)

Jenkins version 2.176.3

robax commented

Hitting this issue as well.

Same issue. Attaching the output I get when I click "Test" under "Configuration of Amazon SQS queues." This is causing constant Java errors to spew into the jenkins.log which quickly exceeds 50GB in size. I believe the problem happened after I recently updated Jenkins and our plugins en masse (a thing I'll never do again). I have tried downgrading the SQS plugin back to 2.0 and the AWS SDK plugin back to 1.11.562. Am working through each plugin in turn, then will try a downgrade of Jenkins itself. I'm using the Jenkins 2.190.3 package from Ubuntu 18.04 LTS.
sqsError.txt

First, a small correction to my post. I am getting the Jenkins package from the Jenkins repository, not from Ubuntu's.

I recovered from this issue by restoring my Jenkins configuration and plugins from a backup taken the day before I upgraded plugins. Then I started testing each plugin one at a time.

For me, this problem is being caused by the Jenkins Git Plugin: https://github.com/jenkinsci/git-plugin. I've verified this multiple times by upgrading the Git plugin to version 4.0.0, restarting, and testing, then downgrading back to 3.10.1, restarting, and testing. I wonder if it's related to https://issues.jenkins-ci.org/browse/JENKINS-55693, but that's speculation on my part. I hope this is helpful to somebody, although the actual issue does not appear to be with the SQS plugin.

ms42 commented

We had the same issue and solved it by adding joda-time to the SQS plugin. See #34

I can confirm I started getting the same error after upgrading the Git plugin to v4.0.0

We had the same issue and solved it by adding joda-time to the SQS plugin. See #34

Seems the code is not merged. I am facing the same issue and need the fix urgently since it is blocking our heavily-used jenkins pipelines. When will it be available?

Same issue here, downgrading the Git plugin to 3.93 solves the issue for now.

seeing the same issue here, thanks for the quick fix of reverting git.

same issue. Downgrading to 3.93 resolved the issue for me too.

Can someone please explain how I can downgrade the git plugin version to 3.93?
Current version is 4.22

Can someone please explain how I can downgrade the git plugin version to 3.93?
Current version is 4.22

Download the HQI file of the version you want from https://updates.jenkins-ci.org/download/plugins/git/. Then follow the instructions at https://www.jenkins.io/doc/book/managing/plugins/#advanced-installation to install the older version.

Hi, what is the movement on this?
We've managed to get Jenkins stable on 3.12.1 but a lot of other plugins now require git 4.+

is there a work around?

Thanks for the quick reply and please forgive my ignorance.

We have jobs that are triggered by sqs

If we remove the sqs-plugin, how do we trigger jobs from an SQS Message?

Thanks @krmenon431 I'll explore this option

Did you try to rebuild #34
looking at my bash history from a few month back, am pretty sure it just took the following:

cd /tmp
wget https://apache.osuosl.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar xzf apache-maven-3.6.3-bin.tar.gz
export PATH=/tmp/apache-maven-3.6.3/bin/:$PATH
git clone https://github.com/jbergknoff-rival/aws-sqs-plugin.git
cd aws-sqs-plugin
git checkout  jbergknoff/joda-time
mvn package

ls target/aws-sqs.hpi

then you just copy the aws-sqs.hpi in your ${jenkins_home}/plugins/aws-sqs.jpi

Our Jenkins has been running with a rebuilt plugin and updated git without issues since.

Hi @cedriclecoz

I tried your steps but had the errors returning
2020-09-22 04:57:51.531+0000 [id=2746] SEVERE h.i.i.InstallUncaughtExceptionHandler$DefaultUncaughtExceptionHandler#uncaughtException: A thread (Thread-2679/2746) died unexpectedly due to an uncaught exception, this may leave your Jenkins in a bad way and is usually indicative of a bug in the code.
java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.auth.internal.AWS4SignerUtils
at com.amazonaws.auth.internal.AWS4SignerRequestParams.(AWS4SignerRequestParams.java:99)
at com.amazonaws.auth.AWS4Signer.sign(AWS4Signer.java:225)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1210)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
at com.amazonaws.services.sqs.AmazonSQSClient.doInvoke(AmazonSQSClient.java:2013)
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:1989)
at com.amazonaws.services.sqs.AmazonSQSClient.executeReceiveMessage(AmazonSQSClient.java:1471)
at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:1447)
at io.relution.jenkins.awssqs.net.SQSChannelImpl.getMessages(SQSChannelImpl.java:65)
at io.relution.jenkins.awssqs.threading.SQSQueueMonitorImpl.processMessages(SQSQueueMonitorImpl.java:196)
at io.relution.jenkins.awssqs.threading.SQSQueueMonitorImpl.run(SQSQueueMonitorImpl.java:139)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Sorry @cedriclecoz, I'm not a java developer, but thanks for making it simple

OK Made some progress, not sure if the order help

  1. Uninstalled awa-sqs plug in
  2. Updated all the Jenkins plug ins
  3. deleted /var/lib/jenkins/plugins/aws-sqs/{META-INF, WEB-INF}
  4. copied the created aws-sqs.hpi
  5. restarted Jenkins

logs look clean
ALSO can see that the plugin version references a locally built version (which didn't before)

^^ Sorry by just copy to your jenkins I meant replace the old one => cp aws-sqs.hpi plugins/aws-sqs.jpi (extension change to .jpi) and restart jenkins.

Thanks to @cedriclecoz and @txynidakis

Compiled the version 2.0.2 which fixed the IAM Authentication bug, that present in the plugin version 2.0.1 available in Jenkins plugins repo.

Hi @cedriclecoz , we had an issue with apply/saving changes in the configs.
We re-built the plugin using you recent commits and that saved our skins!!

Thank you AGAIN!

Hope I'm not speaking out of turn but I would have thought the plugin would have been adopted by now.

@krmenon431 the linkedom post is a 404, are you able to post a new link please?