Java Azure service bus throwing error at run time - java

Error injecting constructor, java.lang.NoClassDefFoundError: com/azure/messaging/servicebus/ServiceBusClientBuilder
Tried with dependency version : 7.0.2.
Also tried with latest version of azure service bus dependency causing runtime error.
Tried with all azure service bus dependency still issue persist.

Related

Error while upgrading grails2.x to grails5.x

I am trying to migrate my application grails2.x to grails 5.x I have upgraded all the dependencies as per the grails5. After resolving all the errors while running grails app using grails run -app I am getting "unable to compile s2-create-role-hierarchy-entry.groovy" unable to find org.grails.web.mime.httpresponse" in grails/config/Config
Could someone help on this.
Tried to find the dependency for missing class but couyfind it in grails5

Gremlin-Driver update causes NoSuchMethodError

I have a Java Spring Boot application that connects to an Amazon Neptune graph database running on engine version 1.1.1.0.
After upgrading the gremlin-driver and TinkerPop dependencies to 3.5.2 from 3.4.6 (working on this version), the application can no longer make a connection to the graph database on AWS and it throws this exception
io.netty.channel.ChannelInitializer : Failed to initialize a channel. Closing: [id: 0xf213a752]ecs/XYZ
java.lang.NoSuchMethodError: io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.<init>(Ljava/net/URI;Lio/netty/handler/codec/http/websocketx/WebSocketVersion;Ljava/lang/String;ZLio/netty/handler/codec/http/HttpHeaders;IZZJ)V
I haven't made any changes with the builder besides the code-breaking change with one of the imports and the method name change. Did I miss something in this update?
This is the builder configuration that I am using from 3.4.6
Cluster.Builder builder = Cluster.build();
builder.addContactPoints(gremlinProperties.getContactPoints());
builder.port(gremlinProperties.getPort());
builder.nioPoolSize(gremlinProperties.getNioPoolSize());
builder.workerPoolSize(gremlinProperties.getWorkerPoolSize());
builder.minConnectionPoolSize(gremlinProperties.getMinConnectionPoolSize());
builder.maxConnectionPoolSize(gremlinProperties.getMaxConnectionPoolSize());
builder.minSimultaneousUsagePerConnection(gremlinProperties.getMinSimultaneousUsagePerConnection());
builder.maxSimultaneousUsagePerConnection(gremlinProperties.getMaxSimultaneousUsagePerConnection());
builder.maxInProcessPerConnection(gremlinProperties.getMaxInProcessPerConnection());
builder.minInProcessPerConnection(gremlinProperties.getMinInProcessPerConnection());
builder.maxWaitForConnection(gremlinProperties.getMaxWaitForConnection());
builder.maxWaitForClose(gremlinProperties.getMaxWaitForSessionClose());
builder.maxContentLength(gremlinProperties.getMaxContentLength());
builder.reconnectInterval(gremlinProperties.getReconnectInterval());
builder.resultIterationBatchSize(gremlinProperties.getResultIterationBatchSize());
builder.keepAliveInterval(gremlinProperties.getKeepAliveInterval());
builder.channelizer(Channelizer.WebSocketChannelizer.class);
builder.enableSsl(gremlinProperties.isEnableSsl());
return builder.create();
The values are extracted from a property file
Since the code that handles the gremlin connection and queries is located in a dependency jar project, the netty.version declared in the main project using that jars overrides the netty.io version that is used in the said jar project. I just have to declare a netty.version property in the main project pom so that it matches the netty version used in the dependency.

Missing dependency on EmbeddedKafka on integration test with groovy and spock

I've been trying to create an integration test using the embeddedKafka, but I'm getting problem of missing dependency when trying to run it, this is the error:
Unable to load class org.springframework.kafka.test.EmbeddedKafkaBroker due to missing dependency org/I0Itec/zkclient/serialize/ZkSerializer
I saw some stuff saying that this is related to my dependencies, so here is my dependencies:
springBootVersion = '2.3.5.RELEASE'
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
compile("org.springframework.kafka:spring-kafka:${springBootVersion}")
testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}",
'org.spockframework:spock-core:1.2-groovy-2.4',
'org.spockframework:spock-spring:1.2-groovy-2.4',
'com.microsoft.azure:spring-data-cosmosdb:2.3.0',
'com.nimbusds:oauth2-oidc-sdk:5.64.4',
)
testCompile("org.springframework.kafka:spring-kafka-test:${springBootVersion}")
So, my question is, am I missing something?
EDIT
After changed the versions as indicated, I got a different error:
Error creating bean with name 'embeddedKafka': Invocation of init
method failed; nested exception is java.lang.NoClassDefFoundError:
scala/math/Ordering$$anon$7
I've added the scala dependencies, but still having the same issue:
testImplementation("org.scala-lang:scala-library:2.12.11")
testImplementation("org.scala-lang:scala-reflect:2.12.11")
You somehow have a mismatched kafka Vs. kafka-clients jars on the classpath; they all must be the same version.
You generally should not specify a version on boot's dependencies and use its dependency management instead.
You are pulling in spring-kafka 2.3.5 whereas spring-boot 2.3.5 requires spring-kafka 2.5.7.
Spring-kafka 2.5.x uses the kafka-clients 2.5.1.
See here for how to override versions of kafka jars when using a different version to the version that Boot prescribes.
the Kafka Client libraries for a time were inlining a particular version of the Scala library. This caused problems for those of us wanting to use the kafka client library with a slightly different version of Scala than that inline version.
In this cases the version of Scala they were using inline is Scala 2.12.10
They removed this dependency in later versions and this was backported as fixes (the earliest being 2.8.0) https://archive.apache.org/dist/kafka/2.8.0/RELEASE_NOTES.html)

How to use org.apache.httpcomponents inside a spark job on Hadoop/Spark?

I am trying to run a spark job on a Hadoop cluster that also makes an http request to another server. I am using org.apache.httpcomponents to make this request, which works fine locally on my machine. However this fails the moment I submit the job to the cluster (managed by Cloudera) with the following error:
User class threw exception: java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.(SSLConnectionSocketFactory.java:151)
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:977)
at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:56)
From all the reading I have done, this error is caused by multiple versions of Apache Http client jar. It appears that Hadoop/Spark engine has it's own dependency to Apache Http client and that is a different version than the one I am using. Because my jar is run as part of the hadoop/spark engine it ends up including both my version of http as well as the one Hadoop requires.
If I add 'compileOnly' for org.apache.httpcomponents in my build.gradle and submit, I get this error instead:
User class threw exception: java.lang.NoClassDefFoundError: org/apache/http/impl/client/HttpClients
Is there a way for me to configure this in gradle so that when I build my jar, it will use the already existing version on Hadoop? ie. A way to declare a temporary dependency (when running locally download and use latest version, but when building UberJar drop the dependency)?
UPDATE
I decided to try swapping to a different http library (okhttp3) to see if that would resolve the issue. However I get a very similar exception when trying to run through the cluster here too:
User class threw exception: java.lang.NoSuchFieldError: Companion
at okhttp3.internal.Util.(Util.kt:70)
at okhttp3.OkHttpClient.(OkHttpClient.kt:959)
Looks like Cloudera also supplies a version of okhttp with it's spark2 client which is unfortunate.

Error when using cosmosdb java sdk ALLOW_TRAILING_COMMA

I am using azure-cosmosdb 2.6.1 version dependency to connect to cosmosdb from spring boot application.
When i try to initialize asyncdocumentclient, I am getting the error
java.lang.NoSuchFieldError: ALLOW_TRAILING_COMMA and the client is not getting initialized. Can u plz help me in fixing this issue
The same is working when i run the application from commandline, but when I use IntellijIDEA IDE its not working. I tried reimporting the dependencies but it is not working.
Stacktrace:
1 = {StackTraceElement#11191} "com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.<clinit>(RxDocumentClientImpl.java:132)"
2 = {StackTraceElement#11192} "com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient$Builder.build(AsyncDocumentClient.java:224)"```

Categories

Resources