How to find which scala version needs to be used for each kafka release

2.5k Views Asked by At

currently we are using kafka-0.7.2(https://clojars.org/org.clojars.paul/core-kafka_2.8.0) and scala version 2.8.0 in production.

we are excited to see kafka 0.8.1.1 so we followed the producer(https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+Producer+Example) code and consumer(https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example) code in the mentioned blog.

This code leads to an error of missing scala.serializer class so I searched and got info that scala-2.10.3(Eclipse scala.object cannot be resolved) will solve this issue.

while running this code again I got an error of

[WARNING] 
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoClassDefFoundError: scala/reflect/ClassManifest
        at kafka.utils.Log4jController$.<init>(Log4jController.scala:29)
        at kafka.utils.Log4jController$.<clinit>(Log4jController.scala)
        at kafka.utils.Logging$class.$init$(Logging.scala:29)



will linger despite being asked to die via interruption
[WARNING] NOTE: 3 thread(s) did not finish despite being asked to  via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=packageName,maxpri=10]
java.lang.IllegalThreadStateException
        at java.lang.ThreadGroup.destroy(ThreadGroup.java:775)
        at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:328)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)

I don't know why this error occurred,

changed pom.xml

<dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.9.2</artifactId>
            <version>0.8.1.1</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.10.3</version>
        </dependency>

I also got info from one of the site that kafka 0.8.1.1 will have a support for different version of scala,but i don't know why it was not supported for this scala version(2.10.3).

How can we find for  x kafka version, y scala version will work

i also figured out that in gradle.properties of kafka-0.8.1.1

group=org.apache.kafka
version=0.8.1.1
scalaVersion=2.8.0
task=build

here mentioned scalaVersion of 2.8.0 is meant for ?

Thanks in advance

1

There are 1 best solutions below

0
kumar On

I have removed the scala dependency,since its using scala internally.now its worked properly and also some changes in property name of zookeeper connections.