Class not Found Error when updated kafka_2.12 dependency - scala

I updated the dependency in my build.gradle file from kafka_2.11 to kafka_2.12.
I am getting the following error when I try to run a testcase after this :
java.lang.NoClassDefFoundError: scala/collection/TraversableOnce$class

Related

java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce at kafka.utils.TestUtils.tempDir(TestUtils.scala)

While using #EmbeddedKafka(topics = { "checkins" })
I am getting an error
Caused by: java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce
at kafka.utils.TestUtils.tempDir(TestUtils.scala)
at org.springframework.kafka.test.EmbeddedKafkaBroker$EmbeddedZookeeper.<init>(EmbeddedKafkaBroker.java:738)
at org.springframework.kafka.test.EmbeddedKafkaBroker.afterPropertiesSet(EmbeddedKafkaBroker.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
I am using spring boot 2.3.3.RELEASE
My gradle looks like
compile("io.confluent:kafka-json-serializer:$confluentJsonVersion")
compile ("org.apache.kafka:kafka-clients: $kafkaVersion")
implementation ("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.kafka:spring-kafak:$springKafkaVersion")
implementation "org.apache.kafka:kafka-clients:$kafkaVersion"
testImplementation("org.springframework.kafka:spring-kafka-test:$springKafkaVersion")
testImplementation("org.apache.kafka:kafka_2.13:$kafkaVersion")
testImplementation("org.apache.kafka:kafka_2.13:$kafkaVersion:test")
testImplementation ("org.apache.kafka:kafka-clients:$kafkaVersion:test")
That interface only exists in the kafka_2.12 jars.
It appears you somehow have a 2.12 ...-test jar and a 2.13 kafka jar (which is not what your gradle says).
What does gradle dependencies say?

How to clean and rebuild a projekt in netbeans when it does not resolve after an refactoring bug?

Exception in thread "main" java.lang.ExceptionInInitializerError
at rooconn.RooConnClient.tryConnect(RooConnClient.java:45)
at rooconn.TestConnection.main(TestConnection.java:28)
Caused by: java.lang.RuntimeException: Uncompilable source code - rooconn.system.FilePutRequestSimple is not abstract and does not override abstract method onServerStreamReady(java.io.InputStream,java.io.OutputStream) in rooconn.RooServerEvents
at rooconn.Request.<clinit>(Request.java:25)
This exception is thrown when I run my project. The problem is, that roocon.system package does not exists anymore, it has been refactored to rooconn.client.
The package does not exists in:
".../src/rooconn/"
".../build/classes/rooconn/"
".../dist/RooConn.jar/rooconn/"
no occurrence in "import" or "package" file headers
class "onServerStreamReady" does not exists anymore, does not exist in file system at any place, no references
Clean and Build does not work. Restarting netbeans does not work.
How to resolve this bug?
Found a workaround:
Create a new project
Add old project as a library
Build
Old project works again now

Maven: Failed to load class for data source: com.databricks.spark.csv

I have a Maven project and I can't make it run:
Exception in thread "main" java.lang.ClassNotFoundException: Failed to load class for data source: com.databricks.spark.csv.
How to fix this in Maven?
PS: I know about this question, but I cannot use any additional options to spark-submit, except --class and --master.
Try maven-shade-plugin in you pom it will create one shade jar with your all dependencies or classes. For more detail go through this link

NoSuchMethodError with Play

I encountered a strange error with Play.
All my tests are OK, but when I run, I have the following error :
java.lang.NoSuchMethodError: controllers.package$.tuple2Writes(Lplay/api/libs/json/Writes;Lplay/api/libs/json/Writes;)Lplay/api/libs/json/Writes;
This method is defined in a package object.
sbt clean doesn't fix

java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()

I am getting this error java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()
at the runtime in eclipse. However, eclipse shows the method on doing intelligence search, but at runtime it fails to identify it.
I am using the latest log4j1.2.16 jar and it is added in the classpath.
Any suggestions?