>From my build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.10.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'calculator'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("org.springframework.boot:spring-boot-starter-test")
compile("org.springframework.kafka:spring-kafka:1.3.2.RELEASE")
testCompile("org.springframework.kafka:spring-kafka-test")
}
And this is from my project structure. I wonder if that is part of the
problem, having .10 and .11?
- Gradle: org.apache.kafka:kafka-clients:0.11.0.0
- Gradle: org.apache.kafka:kafka-clients:test:0.11.0.0
- Gradle: org.apache.kafka:kafka_2.11:0.10.1.1
- Gradle: org.apache.kafka:kafka_2.11:test:0.10.1.1
On Feb 13, 2018 21:09, "Ted Yu" <[email protected]> wrote:
> LoginType was in 0.10.x release.
>
> This seems to indicate Kafka version mismatch.
>
> Can you check the dependencies of your test ?
>
> Thanks
>
> On Tue, Feb 13, 2018 at 8:03 PM, Ian Ewing <[email protected]> wrote:
>
> > I have been trying to figure out how to unit test a kafka producer.
> Should
> > take in a simple integer and perform some addition. Followed what I could
> > find on spring kafka unit testing but keep running into this error:
> >
> > 19:53:12.788 [main] ERROR kafka.server.KafkaServer - [Kafka Server 0],
> > Fatal error during KafkaServer startup. Prepare to shutdown
> > java.lang.NoClassDefFoundError: org/apache/kafka/common/networ
> k/LoginType
> > at kafka.network.Processor.<init>(SocketServer.scala:406)
> > at kafka.network.SocketServer.newProcessor(SocketServer.scala:141)
> > at
> > kafka.network.SocketServer$$anonfun$startup$1$$anonfun$
> > apply$1.apply$mcVI$sp(SocketServer.scala:94)
> > at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
> > at
> > kafka.network.SocketServer$$anonfun$startup$1.apply(SocketSe
> rver.scala:93)
> > at
> > kafka.network.SocketServer$$anonfun$startup$1.apply(SocketSe
> rver.scala:89)
> > at scala.collection.Iterator$class.foreach(Iterator.scala:893)
> > at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
> > at scala.collection.MapLike$DefaultValuesIterable.foreach(
> > MapLike.scala:206)
> > at kafka.network.SocketServer.startup(SocketServer.scala:89)
> > at kafka.server.KafkaServer.startup(KafkaServer.scala:219)
> > at kafka.utils.TestUtils$.createServer(TestUtils.scala:120)
> > at kafka.utils.TestUtils.createServer(TestUtils.scala)
> > at
> > org.springframework.kafka.test.rule.KafkaEmbedded.
> > before(KafkaEmbedded.java:154)
> > at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
> > at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> > at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> > at
> > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(
> > SpringJUnit4ClassRunner.java:191)
> > at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> > at
> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(
> > JUnit4IdeaTestRunner.java:68)
> > at
> > com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.
> > startRunnerWithArgs(IdeaTestRunner.java:51)
> > at
> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(
> > JUnitStarter.java:242)
> > at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStart
> er.java:70)
> > Caused by: java.lang.ClassNotFoundException:
> > org.apache.kafka.common.network.LoginType
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> > ... 23 common frames omitted
> >
> >
> > Has anyone come across this situation? Any ideas on the direction a
> > solution would take? I can provide more information, code, etc. Whatever
> > extra is needed. Don't want to bog down the email with too much.
> >
> > Thanks
> > Ian
> >
>