java.lang.NoSuchFieldError: CLIENT_ENDPOINT for Amazon ECS - java

I tried to list the ECS clusters using the code as follow:
AmazonECS = amazonECS AmazonECSClientBuilder.standard().withRegion(region).withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build():
amazonECS.listClusters();
However, it gave the error
java.lang.NoSuchFieldError: CLIENT_ENDPOINT
The error stack is something like this:
com.amazonaws.services.ecs.AmazonECSClient in executeListClusters at
line 2220 com.amazonaws.services.ecs.AmazonECSClient in listClusters
at line 2202 com.amazonaws.services.ecs.AmazonECSClient in
listClusters at line 2245
I am not too sure why this error occurred as the other Amazon services did not give me any similar error whatsoever and I have set the region previously based on the client's preference. Any ideas?

Thanks to Nagaraj Trantri the error is caused by the version mismatched of the AWS SDK that I have according to https://github.com/aws/aws-sdk-java/issues/2509#issuecomment-779370672

I had different version for SQS and S3 in pom.xml. After I updated those to same versions, it worked.

It depends on where to look for these versions mismatch.
I am using spark to connect to secrets manager and thus we have 2 places to look at.
My Application dependencies (build.gradle)
spark.yarn.jars
The versions in the above 2 places should match and then it started working

Use this in the pom.xml file. Error is caused due to mismatch in the 'com.amazonaws' dependency versions declared in the pom.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.739</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sts</artifactId>
</dependency>
</dependencies>

Related

How do I use an older Keycloak client with Quarkus 2.13, Keycloak 19 client is not backwards compatible with v18 server

Would like to ask how to override the Keycloak version used by the Quarkus 2.13 BOM to Keycloak 18? My quarkus service could not connect to our Keycloak servers which still use v18. I have lost the error message in my logs but it said something about client secret is invalid when using Keycloak v19 client, but when downgrading to v18, there were no issues.
This PR 27387 in Quarkus bumped the Keycloak version and it broke compatibility. I have tried overriding the property <keycloak.version>18.0.2</keycloak.version> in POM but it doesn't work, it keeps using the same dependency org.keycloak:keycloak-core:19.0.2 and I even tried overriding the dependency quarkus-keycloak-authorization like so
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-keycloak-authorization</artifactId>
<version>2.12.3.Final</version> <!-- last quarkus version that used keycloak 18 -->
</dependency>
but it's still the same thing? I'm using a managed Keycloak server - Cloud IAM (Free tier) so any server upgrades wouldn't be easy. Or are there any alternative configurations I can use with Keycloak to make the client backward compatible, the error I'm encountering is the following during application startup
2022-10-18 06:50:14,785 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile prod):
org.keycloak.authorization.client.util.HttpResponseException: Unexpected response from server:
401 / Unauthorized / Response from server: {"error":"unauthorized_client","error_description":"Invalid client secret"}
at org.keycloak.authorization.client.util.HttpMethod.execute(HttpMethod.java:95)
at org.keycloak.authorization.client.util.HttpMethodResponse$2.execute(HttpMethodResponse.java:50)
I was able to resolve the issue by overriding quarkus bom in pom.xml through <dependencyManagement/> like so, the keycloak pom should be above quarkus for it to override
<dependencyManagement>
<dependencies>
<!-- retain compatibility with keycloak 18 -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-keycloak-authorization</artifactId>
<!-- last quarkus version that used keycloak 18 -->
<version>2.12.3.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependencies>
</dependencyManagement>
I get a warning during mvn compile though, but as per this Issue #1577, it is intended
[io.quarkus.maven.MavenDevModeLauncher$Builder] io.quarkus:quarkus-bootstrap-maven-
resolver::jar classpath entry C:\Users\Vince\.m2\repository\io\quarkus\quarkus-
bootstrap-maven-resolver\2.13.2.Final\quarkus-bootstrap-maven-resolver-2.13.2.
Final.jar was overriden with C:\Users\Vince\.m2\repository\io\quarkus\
quarkus-bootstrap-maven-resolver\2.12.3.Final\quarkus-bootstrap-maven-resolver-
2.12.3.Final.jar
Hope it can help others that were encountering the same issue, and take a quick read on the PR above, overriding the BOM versions can cause nasty unintended side effects.

smallrye.jwt.sign.key-location is Unknown property in application.properties

I am currently trying to add JWT to my quarkus project but I have run into some roadblocks.
In my application.properties I have set the following settings:
mp.jwt.verify.publickey.location=publicKey.pem
smallrye.jwt.sign.key-location = privatetestKey.pem
mp.jwt.verify.issuer=https://example.com/issuer
but now I get the error:
Unknown property 'smallrye.jwt.sign.key-location'
I should have installed every necessary dependency in my pom.xml:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt-build</artifactId>
</dependency>
Or have I forgotten something?
The configuration name was renamed to smallrye.jwt.sign.key.location (no dash between key and location), but I believe that the old one should still work because it was only deprecated.
Please try with the new name: https://quarkus.io/guides/security-jwt#additional-smallrye-jwt-configuration

JENA error TurtleParseException when executing JAR

I made a program that parses turtle files with Jena library. These are the dependencies i use:
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-iri</artifactId>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-tdb</artifactId>
<version>3.10.0</version>
</dependency>
So the parsing is working well on my java program but when i create my jar and try to run it, i have these kind of errors :
ERROR JenaService:146 - org.apache.jena.n3.turtle.TurtleParseException: Line 28015, column 79: org.apache.jena.iri.impl.IRIImplException:
<http://www.reussir.fr,> Code: 28/NOT_DNS_NAME in HOST: The host component did not meet the restrictions on DNS names.
Any ideas ?
EDIT
I have a warning for the invalid IRI problem by running my program with the IDE, but still giving me errors with the generated jar.
<http://www.reussir.fr,>
There is a comma in the URI in a place where commas are not allowed.
It is better to find and fix the data problem because it can lead to other problems later if not fixed.
I found the problem, the only dependency i really needed was jena-arq, so i removed others dependencies (especially jena-iri which was throwing the TurtleParseException) and the bad-iri errors became warnings like in the IDE execution logs.

maven dependency conflict java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory error when creating aws S3 client

I am getting the below error when I am trying to create amazon S3 client. It worked earlier and after I have done few code changed from then on I am seeing this error. I feel it could be of some dependency conflict but unable to find it out. Try many things but nothing could help.
java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory.<init>(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)V
at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.<init>(SdkTLSSocketFactory.java:56)
at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.getPreferredSocketFactory(ApacheConnectionManagerFactory.java:91)
at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(ApacheConnectionManagerFactory.java:65)
at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(ApacheConnectionManagerFactory.java:58)
at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(ApacheHttpClientFactory.java:51)
at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(ApacheHttpClientFactory.java:39)
at com.amazonaws.http.AmazonHttpClient.<init>(AmazonHttpClient.java:301)
at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:164)
at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:523)
at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:503)
at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:485)
at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:457)
at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:439)
at com.ge.hc.cloud.e2e.workflows.steps.BasicWorkflowSteps.<clinit>(BasicWorkflowSteps.java:72)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:386)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at net.thucydides.core.steps.StepFactory.webEnabledStepLibrary(StepFactory.java:201)
at net.thucydides.core.steps.StepFactory.createProxyStepLibrary(StepFactory.java:164)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:117)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:109)
at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:77)
at net.thucydides.core.steps.StepFactory.getStepLibraryFor(StepFactory.java:72)
at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:52)
at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:41)
at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:23)
at net.serenitybdd.jbehave.SerenityStepFactory.createInstanceOfType(SerenityStepFactory.java:80)
at org.jbehave.core.steps.StepCreator.stepsInstance(StepCreator.java:83)
at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:595)
at org.jbehave.core.embedder.StoryRunner$FineSoFar.run(StoryRunner.java:566)
Appreciate any kind of help.
I faced the similar issue. I was using AWS JavaV2 SDK software.amazon.awssdk with version 2.19.14.
The Amazon Java SDK jar that I had imported had a dependency on org.apache.httpcomponents. Once I imported the dependency and built the project again, I was able to create the client.
My pom.xml looked something like this.
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssm</artifactId>
</dependency>
</dependencies>

Getting this error while trying to connect facebook chat using smack

Getting this error while trying to connect facebook chat using smack.
jars used smack 3.3.1.jar,smackx 3.3.1.jar
Exception in thread "main" java.lang.AbstractMethodError: org.jivesoftware.smackx.ServiceDiscoveryManager$1.connectionCreated(Lorg/jivesoftware/smack/Connection;)V
at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:652)
at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:604)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1022)
at com.FacebookChatSample.main(FacebookChatSample.java:30)
I've had the same problem. Turned out that I didn't put the right package in my pom.xml
I used the following Maven dependency :
<dependency>
<groupId>jivesoftware</groupId>
<artifactId>smack</artifactId>
<version>3.1.0</version>
</dependency>
and it gave me the error when I tried to connect to my server. When I changed it to :
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smackx</artifactId>
<version>3.2.1</version>
</dependency>
it worked.
Note : smack dependency was another entry from the beggining and should be left this way:
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack</artifactId>
<version>3.2.1</version>
</dependency>
Note 2 : I didn't explixitly use anything from smackx, it is used in XMPPConnection.initConnection() there where it tries to inform all the ConnectionCreationListener listeners that a connection has just been established.

Categories