Getting errors in SQS after updating mirth connect version to v4.5 #6243
Replies: 1 comment
-
Did you also load the AWS SDK JARs that include this class? Mirth includes some AWS libraries to support S3 but I do not know if they inlcude the STS classes. Are you using Did you update your channel dependencies in the summary tab?
If you're stuck or on a tight deadline, getting consulting hours could be helpful https://github.com/rogin/mirth-consulting You can also do a few things to see whats in the JAR:
|
Beta Was this translation helpful? Give feedback.
-
Hi all, I am getting error afters i upgraded my mirth connect from v3.1.2 to v4.5. We are currently using a custom jar file which we retrieved from our v3.1.2 version and placed it in the custom-lib folder, because the current jar file is created by our previous developer which left the team. We also tried to create the jar file ourself upon googling, but we still getting this "could not initialize class" but for different classes. Appreciate if anyone could provide some advice on this, as I am quite new into mirth connect.
Thanks!
SQS CODE:
`logger.info("LabResultInsertedId:"+JSON.stringify(parseInt(channelMap.get("LabResultInsertedId"))))
var software = Packages.software;
var sqsRegion = software.amazon.awssdk.regions.Region.AP_SOUTHEAST_1;
var sqsUrl = globalMap.get('LAB_RESULT_SEND_SQS_URL_DESTINATION');
var roleRequest = software.amazon.awssdk.services.sts.model.AssumeRoleRequest;
var StsClient = software.amazon.awssdk.services.sts.StsClient;
var roleArn = globalMap.get('LAB_RESULT_SEND_SQS_IAM_ROLE');
var roleSessionName = 'awssdk';
var stsBuilder = StsClient.builder().region(sqsRegion).build();
var roleRequest = roleRequest.builder().roleArn(roleArn).roleSessionName(roleSessionName).build();
var assumeRole = stsBuilder.assumeRole(roleRequest);
var sqsKey = assumeRole.credentials().accessKeyId();
var sqsSecret = assumeRole.credentials().secretAccessKey();
var sqsSessionToken = assumeRole.credentials().sessionToken();
logger.info(JSON.stringify(parseInt(channelMap.get("LabResultInsertedId"))))
var credentialsProvider = software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(software.amazon.awssdk.auth.credentials.AwsSessionCredentials.create(sqsKey,sqsSecret,sqsSessionToken));
var sqs = software.amazon.awssdk.services.sqs.SqsClient.builder().credentialsProvider(credentialsProvider).region(sqsRegion).build();
var sendMessageRequest = software.amazon.awssdk.services.sqs.model.SendMessageRequest;
var r = sqs.sendMessage(sendMessageRequest.builder().queueUrl(sqsUrl).messageBody(JSON.stringify(parseInt(channelMap.get("LabResultInsertedId")))).build());
logger.info("Send To SQS Queue Channel: Sent Message to SQS.");`
Error example:
JavaScript Writer error ERROR MESSAGE: Error evaluating JavaScript Writer java.lang.NoClassDefFoundError: Could not initialize class software.amazon.awssdk.services.sts.DefaultStsClientBuilder at software.amazon.awssdk.services.sts.StsClient.builder(StsClient.java:2335) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:226) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1669) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1009) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:412) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3545) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:121) at com.mirth.connect.server.util.javascript.JavaScriptTask.executeScript(JavaScriptTask.java:151) at com.mirth.connect.connectors.js.JavaScriptDispatcher$JavaScriptDispatcherTask.doCall(JavaScriptDispatcher.java:261) at com.mirth.connect.connectors.js.JavaScriptDispatcher$JavaScriptDispatcherTask.doCall(JavaScriptDispatcher.java:221) at com.mirth.connect.server.util.javascript.JavaScriptTask.call(JavaScriptTask.java:114) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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:750)
Beta Was this translation helpful? Give feedback.
All reactions