I've been using the Maven package without issue. Of course, I'm not using
Spring, either. Here's the relevant section from a working pom:

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.9.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.9.1</artifactId>
            <version>0.8.0-beta1</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <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>



On Tue, Aug 27, 2013 at 11:10 AM, David Williams <dwilli...@truecar.com>wrote:

>
> So an update.  The required version of log4j is
>
> <dependency>
>    <groupId>log4j</groupId>
>    <artifactId>log4j</artifactId>
>    <version>1.2.17</version>
>         </dependency>
>
>
> Joe, why is this so hard / undocumented / not caught at compile time?
>
>
> Now we have another error:
>
> Exception in thread "main" java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:5
> 7)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> l.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at com.simontuffs.onejar.Boot.run(Boot.java:340)
>         at com.simontuffs.onejar.Boot.main(Boot.java:166)
> Caused by: java.lang.NoClassDefFoundError:
> org/I0Itec/zkclient/IZkStateListener
>         at
> kafka.javaapi.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerC
> onnector.scala:64)
>         at
> kafka.javaapi.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerC
> onnector.scala:66)
>         at
> kafka.consumer.Consumer$.createJavaConsumerConnector(ConsumerConnector.scal
> a:100)
>         at
> kafka.consumer.Consumer.createJavaConsumerConnector(ConsumerConnector.scala
> )
> ... 6 more
> Caused by: java.lang.ClassNotFoundException:
> org.I0Itec.zkclient.IZkStateListener
>         at
> com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:713)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>         at
> com.simontuffs.onejar.JarClassLoader.loadClass(JarClassLoader.java:630)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>         ... 12 more
>
>
>
>
>
>
> --
>
>
>
>
>
>
> On 8/27/13 9:54 AM, "David Williams" <dwilli...@truecar.com> wrote:
>
> >Ok great, thanks.  What are the other required dependencies?
> >
> >
> >For exmaple, log4j seems needed:
> >
> >
> >Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
> >       at kafka.utils.Logging$class.logger(Logging.scala:24)
> >       at
> kafka.utils.VerifiableProperties.logger(VerifiableProperties.scala:23)
> >       at kafka.utils.Logging$class.info(Logging.scala:66)
> >       at kafka.utils.VerifiableProperties.info
> (VerifiableProperties.scala:23)
> >       at
> >kafka.utils.VerifiableProperties.verify(VerifiableProperties.scala:180)
> >       at kafka.producer.ProducerConfig.<init>(ProducerConfig.scala:57)
> >
> >
> >
> >However adding the following dependencies are not compatible
> >
> ><dependency>
> >  <groupId>org.slf4j</groupId>
> >  <artifactId>slf4j-api</artifactId>
> >  <version>1.7.5</version>
> >        </dependency>
> >        <dependency>
> >  <groupId>ch.qos.logback</groupId>
> >  <artifactId>logback-classic</artifactId>
> >  <version>1.0.13</version>
> ></dependency>
> >        <dependency>
> >  <groupId>ch.qos.logback</groupId>
> >  <artifactId>logback-core</artifactId>
> >  <version>1.0.13</version>
> >        </dependency>
> >        <dependency>
> >  <groupId>ch.qos.logback</groupId>
> >  <artifactId>log4j-bridge</artifactId>
> >  <version>0.9.7</version>
> >        </dependency>
> >
> >
> >Because is produces this error:
> >
> >
> >Exception in thread "main" java.lang.reflect.InvocationTargetException
> >       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >       at
> >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> >5
> >7)
> >       at
> >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> >p
> >l.java:43)
> >       at java.lang.reflect.Method.invoke(Method.java:606)
> >       at com.simontuffs.onejar.Boot.run(Boot.java:340)
> >       at com.simontuffs.onejar.Boot.main(Boot.java:166)
> >Caused by: java.lang.NoSuchMethodError:
> >ch.qos.logback.classic.Logger.filterAndLog(Ljava/lang/String;Lorg/slf4j/Ma
> >r
> >ker;Lch/qos/logback/classic/Level;Ljava/lang/String;[Ljava/lang/Object;Lja
> >v
> >a/lang/Throwable;)V
> >       at org.apache.log4j.Category.log(Category.java:333)
> >       at
> >org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:177)
> >
> >
> >
> >
> >
> >
> >--
> >
> >
> >
> >
> >
> >
> >On 8/27/13 9:45 AM, "Joe Stein" <crypt...@gmail.com> wrote:
> >
> >>2.8.0, 2.8.2, 2.9.1, 2.9.2 are all supported
> >>
> >>your POM needs a fix though, you need to match your scala-library with
> >>your
> >>kafka artifactID
> >>
> >>so your Kafka artifactID = kafka_2.9.2 so your Scala version should be
> >>2.9.2
> >>
> >>
> >>
> >>/*******************************************
> >> Joe Stein
> >> Founder, Principal Consultant
> >> Big Data Open Source Security LLC
> >> http://www.stealth.ly
> >> Twitter: @allthingshadoop <http://www.twitter.com/allthingshadoop>
> >>********************************************/
> >>
> >>
> >>On Tue, Aug 27, 2013 at 12:41 PM, David Williams
> >><dwilli...@truecar.com>wrote:
> >>
> >>> Thank you for the replies. Is there a minor version in specific you
> >>> recommend using?
> >>>
> >>> I have tried 2.8.[012] and receive a similar runtime exception:
> >>>
> >>> Caused by: java.lang.NoClassDefFoundError: scala/Tuple2$mcJJ$sp
> >>>         at
> >>>kafka.consumer.ConsumerConfig.<init>(ConsumerConfig.scala:77)
> >>>         at com.example.Config.createConsumerConfig(Config.java:40)
> >>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>         at
> >>>
> >>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> >>>a
> >>>:5
> >>> 7)
> >>>         at
> >>>
> >>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> >>>I
> >>>mp
> >>> l.java:43)
> >>>         at java.lang.reflect.Method.invoke(Method.java:606)
> >>>         at
> >>>
> >>>
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.in
> >>>s
> >>>ta
> >>> ntiate(SimpleInstantiationStrategy.java:160)
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Just in case its useful here are my fill list of dependencies for my
> >>> starter project:
> >>>
> >>>
> >>> <dependencies>
> >>>     <dependency>
> >>>         <groupId>org.springframework</groupId>
> >>>         <artifactId>spring-core</artifactId>
> >>>         <version>3.2.4.RELEASE</version>
> >>>     </dependency>
> >>>     <dependency>
> >>>          <groupId>org.springframework</groupId>
> >>>          <artifactId>spring-context</artifactId>
> >>>          <version>3.2.4.RELEASE</version>
> >>>      </dependency>
> >>>      <dependency>
> >>>          <groupId>org.apache.kafka</groupId>
> >>>          <artifactId>kafka_2.9.2</artifactId>
> >>>          <version>0.8.0-beta1</version>
> >>>     </dependency>
> >>>     <dependency>
> >>>          <groupId>javax.inject</groupId>
> >>>          <artifactId>javax.inject</artifactId>
> >>>          <version>1</version>
> >>>     </dependency>
> >>>     <dependency>
> >>>          <groupId>org.scala-lang</groupId>
> >>>          <artifactId>scala-library</artifactId>
> >>>          <version>2.8.0</version>
> >>>     </dependency>
> >>>     </dependencies>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On 8/26/13 9:33 PM, "Joe Stein" <crypt...@gmail.com> wrote:
> >>>
> >>> >Scala 2.10 support is slated for 0.8.1 release after a 0.8.0 release.
> >>> >Here is the patch you can apply if you need
> >>> >https://issues.apache.org/jira/browse/KAFKA-717
> >>> >
> >>> >
> >>> >/*******************************************
> >>> > Joe Stein
> >>> > Founder, Principal Consultant
> >>> > Big Data Open Source Security LLC
> >>> > http://www.stealth.ly
> >>> > Twitter: @allthingshadoop
> >>> >********************************************/
> >>> >
> >>> >
> >>> >On Aug 27, 2013, at 12:16 AM, David Williams <dwilli...@truecar.com>
> >>> >wrote:
> >>> >
> >>> >>
> >>> >> Hi Jay,
> >>> >>
> >>> >> To which jars are you referring?  Does scala have a Maven coodinate?
> >>> As
> >>> >> it stands I am compiling with.
> >>> >>
> >>> >>
> >>> >> <dependency>
> >>> >>    <groupId>org.scala-lang</groupId>
> >>> >>    <artifactId>scala-library</artifactId>
> >>> >>    <version>2.10.2</version>
> >>> >>        </dependency>
> >>> >>        <dependency>
> >>> >>    <groupId>org.scala-lang</groupId>
> >>> >>    <artifactId>scala-reflect</artifactId>
> >>> >>    <version>2.10.2</version>
> >>> >> </dependency>
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >> On 8/26/13 8:35 PM, "Jay Kreps" <jay.kr...@gmail.com> wrote:
> >>> >>
> >>> >>> Nothing complex here, you just don't have the the scala library on
> >>>your
> >>> >>> classpath. It works just like any jar--if there is a dependency on
> >>> >>>classes
> >>> >>> in the jar it needs to be on the classpath.
> >>> >>>
> >>> >>>
> >>> >>> On Mon, Aug 26, 2013 at 7:10 PM, David Williams
> >>> >>> <dwilli...@truecar.com>wrote:
> >>> >>>
> >>> >>>> Hi all,
> >>> >>>>
> >>> >>>> First let me say I have detailed the description of the issue I
> >>>have
> >>> >>>>in
> >>> >>>> an
> >>> >>>> Stack Overflow Ticket here:
> >>> >>>>
> >>> >>>>
> >>> >>>>
> >>> >>>>
> >>> >>>>
> >>>
> http://stackoverflow.com/questions/18455480/kafka-quickstart-java-lang-
> >>> >>>>no
> >>> >>>> classdeffounderror-scala-scalaobject
> >>> >>>>
> >>> >>>> I am trying to build a small prototype for a project in which I
> >>>want
> >>> >>>>to
> >>> >>>> use Kafka.  I am following this example:
> >>> >>>>
> >>> >>>>
> >>> >>>>
> >>>
> https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Exampl
> >>> >>>>e
> >>> >>>>
> >>> >>>>
> >>> >>>> However, when I compile and run the code I get this runtime
> >>>exception.
> >>> >>>> What should I do to get a working prototype / example???
> >>> >>>>
> >>> >>>>
> >>> >>>> Exception in thread "main"
> >>>java.lang.reflect.InvocationTargetException
> >>> >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> >>>>>>>.
> >>>>>>>ja
> >>> >>>>va
> >>> >>>> :57)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> >>>>>>>s
> >>>>>>>so
> >>> >>>>rI
> >>> >>>> mpl.java:43)
> >>> >>>> at java.lang.reflect.Method.invoke(Method.java:606)
> >>> >>>> at com.simontuffs.onejar.Boot.run(Boot.java:340)
> >>> >>>> at com.simontuffs.onejar.Boot.main(Boot.java:166)
> >>> >>>> Caused by: java.lang.NoClassDefFoundError: scala/ScalaObject
> >>> >>>> at java.lang.ClassLoader.defineClass1(Native Method)
> >>> >>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.defineClass(JarClassLoader.java
> >>>>>>>:
> >>>>>>>80
> >>> >>>>3)
> >>> >>>> at
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:7
> >>>>>>>1
> >>>>>>>0)
> >>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> >>> >>>> at
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.loadClass(JarClassLoader.java:6
> >>>>>>>3
> >>>>>>>0)
> >>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> >>> >>>> at java.lang.ClassLoader.defineClass1(Native Method)
> >>> >>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.defineClass(JarClassLoader.java
> >>>>>>>:
> >>>>>>>80
> >>> >>>>3)
> >>> >>>> at
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:7
> >>>>>>>1
> >>>>>>>0)
> >>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> >>> >>>> at
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.loadClass(JarClassLoader.java:6
> >>>>>>>3
> >>>>>>>0)
> >>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> >>> >>>> at java.lang.Class.getDeclaredMethods0(Native Method)
> >>> >>>> at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
> >>> >>>> at java.lang.Class.getDeclaredMethods(Class.java:1845)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.core.type.StandardAnnotationMetadata.getAnnotate
> >>>>>>>d
> >>>>>>>Me
> >>> >>>>th
> >>> >>>> ods(StandardAnnotationMetadata.java:180)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.annotation.ConfigurationClassParser.doPr
> >>>>>>>o
> >>>>>>>ce
> >>> >>>>ss
> >>> >>>> ConfigurationClass(ConfigurationClassParser.java:222)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.annotation.ConfigurationClassParser.proc
> >>>>>>>e
> >>>>>>>ss
> >>> >>>>Co
> >>> >>>> nfigurationClass(ConfigurationClassParser.java:165)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.annotation.ConfigurationClassParser.pars
> >>>>>>>e
> >>>>>>>(C
> >>> >>>>on
> >>> >>>> figurationClassParser.java:140)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.annotation.ConfigurationClassPostProcess
> >>>>>>>o
> >>>>>>>r.
> >>> >>>>pr
> >>> >>>>
> >>>ocessConfigBeanDefinitions(ConfigurationClassPostProcessor.java:282)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.annotation.ConfigurationClassPostProcess
> >>>>>>>o
> >>>>>>>r.
> >>> >>>>po
> >>> >>>>
> >>>
> >>>>>>>stProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java
> >>>>>>>:
> >>>>>>>22
> >>> >>>>3)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.support.AbstractApplicationContext.invok
> >>>>>>>e
> >>>>>>>Be
> >>> >>>>an
> >>> >>>> FactoryPostProcessors(AbstractApplicationContext.java:630)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.support.AbstractApplicationContext.refre
> >>>>>>>s
> >>>>>>>h(
> >>> >>>>Ab
> >>> >>>> stractApplicationContext.java:461)
> >>> >>>> at
> >>> >>>>
> >>> >>>>
> >>>
> >>>>>>>org.springframework.context.annotation.AnnotationConfigApplicationCo
> >>>>>>>n
> >>>>>>>te
> >>> >>>>xt
> >>> >>>> .<init>(AnnotationConfigApplicationContext.java:73)
> >>> >>>> ... 6 more
> >>> >>>> Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
> >>> >>>> at
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:7
> >>>>>>>1
> >>>>>>>3)
> >>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> >>> >>>> at
> >>> >>>>
> >>>
> >>>>>>>com.simontuffs.onejar.JarClassLoader.loadClass(JarClassLoader.java:6
> >>>>>>>3
> >>>>>>>0)
> >>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> >>> >>>> ... 34 more
> >>> >>>>
> >>> >>>> --
> >>> >>>>
> >>> >>>>
> >>> >>
> >>>
> >>>
> >
>
>

Reply via email to