How to fix Kafka for JUnit dependencies problem?Producer#initTransactions doesn't work with KafkaContainerHow do you assert that a certain exception is thrown in JUnit 4 tests?Why doesn't JUnit provide assertNotEquals methods?JUnit test for System.out.println()Conditionally ignoring tests in JUnit 4java.lang.VerifyError: Bad type on operand stack while running JUnit Test casesCannot test with JUnit, Maven and SpringException in thread “streaming-start” java.lang.NoSuchMethodError: org.apache.kafka.clients.consumer.KafkaConsumer.subscribe(Ljava/util/Collection;)VUnsatisfied dependency expressed while injecting Bean in Unit testApache Flink 1.4 with Apache Kafka 1.0.0java.lang.NoClassDefFoundError (CheckpointedRestoring) when trying to create a Kafka Consumer in Flink

Where to place an artificial gland in the human body?

Why is chess failing to attract big name sponsors?

Sextortion with actual password not found in leaks

Spacing setting of math mode

How to optimize IN query on indexed column

How can I tell if there was a power cut while I was out?

What are the exact meanings of roll, pitch and yaw?

Strange Cron Job takes up 100% of CPU Ubuntu 18 LTS Server

Passing lines from the text file of a list of files to or as arguments

kids pooling money for Lego League and taxes

Invert Some Switches on a Switchboard

Is it normal practice to screen share with a client?

How did C64 games handle music during gameplay?

Why keep the bed heated after initial layer(s) with PLA (or PETG)?

What is the purpose of the fuel shutoff valve?

Moving files accidentally to an not existing directory erases files?

How can I stop myself from micromanaging other PCs' actions?

What is the difference between 1/3, 1/2, and full casters?

401(k) investment after being fired. Do I own it?

What does Kasparov mean here?

Should I leave my PhD after 3 years with a Masters?

Why are angular mometum and angular velocity not necessarily parallel, but linear momentum and linear velocity are always parallel?

Should I describe a character deeply before killing it?

Is Grandpa Irrational? Another Grandpa Mystery



How to fix Kafka for JUnit dependencies problem?


Producer#initTransactions doesn't work with KafkaContainerHow do you assert that a certain exception is thrown in JUnit 4 tests?Why doesn't JUnit provide assertNotEquals methods?JUnit test for System.out.println()Conditionally ignoring tests in JUnit 4java.lang.VerifyError: Bad type on operand stack while running JUnit Test casesCannot test with JUnit, Maven and SpringException in thread “streaming-start” java.lang.NoSuchMethodError: org.apache.kafka.clients.consumer.KafkaConsumer.subscribe(Ljava/util/Collection;)VUnsatisfied dependency expressed while injecting Bean in Unit testApache Flink 1.4 with Apache Kafka 1.0.0java.lang.NoClassDefFoundError (CheckpointedRestoring) when trying to create a Kafka Consumer in Flink






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to use Kafka for JUnit, so I added this dependency:



<dependency>
<groupId>net.mguenther.kafka</groupId>
<artifactId>kafka-junit</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>


Locally it works well. But on Jenkins I get an error:




java.lang.NoClassDefFound scala/math/Ordering




If I add scala-library dependency (version 2.1.12), I get:




java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$




Also, I have several Apache Beam dependencies with 2.9.0 version.



What can I check to solve this issue?



UPD:



If I add this dependency:



<dependency>
<groupId>com.github.charithe</groupId>
<artifactId>kafka-junit</artifactId>
<version>$kafkaJunit.version</version>
</dependency>


I get:




java.lang.NoClassDefFoundError: scala/MatchError




If I add scala-library (version 2.1.12), I get:




java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)[Ljava/lang/Object;




And with the last version, I get:




java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$











share|improve this question






























    0















    I want to use Kafka for JUnit, so I added this dependency:



    <dependency>
    <groupId>net.mguenther.kafka</groupId>
    <artifactId>kafka-junit</artifactId>
    <version>2.1.0</version>
    <scope>test</scope>
    </dependency>


    Locally it works well. But on Jenkins I get an error:




    java.lang.NoClassDefFound scala/math/Ordering




    If I add scala-library dependency (version 2.1.12), I get:




    java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$




    Also, I have several Apache Beam dependencies with 2.9.0 version.



    What can I check to solve this issue?



    UPD:



    If I add this dependency:



    <dependency>
    <groupId>com.github.charithe</groupId>
    <artifactId>kafka-junit</artifactId>
    <version>$kafkaJunit.version</version>
    </dependency>


    I get:




    java.lang.NoClassDefFoundError: scala/MatchError




    If I add scala-library (version 2.1.12), I get:




    java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)[Ljava/lang/Object;




    And with the last version, I get:




    java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$











    share|improve this question


























      0












      0








      0








      I want to use Kafka for JUnit, so I added this dependency:



      <dependency>
      <groupId>net.mguenther.kafka</groupId>
      <artifactId>kafka-junit</artifactId>
      <version>2.1.0</version>
      <scope>test</scope>
      </dependency>


      Locally it works well. But on Jenkins I get an error:




      java.lang.NoClassDefFound scala/math/Ordering




      If I add scala-library dependency (version 2.1.12), I get:




      java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$




      Also, I have several Apache Beam dependencies with 2.9.0 version.



      What can I check to solve this issue?



      UPD:



      If I add this dependency:



      <dependency>
      <groupId>com.github.charithe</groupId>
      <artifactId>kafka-junit</artifactId>
      <version>$kafkaJunit.version</version>
      </dependency>


      I get:




      java.lang.NoClassDefFoundError: scala/MatchError




      If I add scala-library (version 2.1.12), I get:




      java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)[Ljava/lang/Object;




      And with the last version, I get:




      java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$











      share|improve this question
















      I want to use Kafka for JUnit, so I added this dependency:



      <dependency>
      <groupId>net.mguenther.kafka</groupId>
      <artifactId>kafka-junit</artifactId>
      <version>2.1.0</version>
      <scope>test</scope>
      </dependency>


      Locally it works well. But on Jenkins I get an error:




      java.lang.NoClassDefFound scala/math/Ordering




      If I add scala-library dependency (version 2.1.12), I get:




      java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$




      Also, I have several Apache Beam dependencies with 2.9.0 version.



      What can I check to solve this issue?



      UPD:



      If I add this dependency:



      <dependency>
      <groupId>com.github.charithe</groupId>
      <artifactId>kafka-junit</artifactId>
      <version>$kafkaJunit.version</version>
      </dependency>


      I get:




      java.lang.NoClassDefFoundError: scala/MatchError




      If I add scala-library (version 2.1.12), I get:




      java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)[Ljava/lang/Object;




      And with the last version, I get:




      java.lang.NoClassDefFound com.typesafe.scalalogging.Logger$








      junit apache-kafka






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 16:19







      Daria Pydorenko

















      asked Mar 26 at 15:02









      Daria PydorenkoDaria Pydorenko

      1,0742 gold badges6 silver badges33 bronze badges




      1,0742 gold badges6 silver badges33 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          UPD



          I got an exception using Kafka for JUnit as @AntonLitvinenko suggested. My question about it here.



          I added this dependency to fix it (see the issue):



          <dependency>
          <groupId>org.apache.curator</groupId>
          <artifactId>curator-test</artifactId>
          <version>2.12.0</version>
          <exclusions>
          <exclusion>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
          </exclusion>
          </exclusions>
          <scope>test</scope>
          </dependency>


          Also, I used 2.0.1 version for kafka-junit and kafka_2.11:



          <dependency>
          <groupId>org.apache.kafka</groupId>
          <artifactId>kafka_2.11</artifactId>
          <version>$kafkaVersion</version>
          <scope>test</scope>
          </dependency>



          OLD



          I decided to use another Kafka-JUnit library by Salesforce. I added this group of dependencies:



          <!-- Declare kafka-junit4 dependency -->
          <dependency>
          <groupId>com.salesforce.kafka.test</groupId>
          <artifactId>kafka-junit4</artifactId>
          <version>3.1.1</version>
          <scope>test</scope>
          </dependency>

          <!-- Include Kafka 2.0.x -->
          <dependency>
          <groupId>org.apache.kafka</groupId>
          <artifactId>kafka_2.11</artifactId>
          <version>2.0.1</version>
          <scope>test</scope>
          </dependency>
          <dependency>
          <groupId>org.apache.kafka</groupId>
          <artifactId>kafka-clients</artifactId>
          <version>2.0.1</version>
          <scope>test</scope>
          </dependency>


          And now my test works well.



          You can see the usage instructions of this library here.



          I tried to increase Kafka version to 2.1.1 and I have an exception:




          java.lang.NoClassDefFoundError: scala/Function1




          So, I think the main problem is used Kafka version.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360327%2fhow-to-fix-kafka-for-junit-dependencies-problem%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            UPD



            I got an exception using Kafka for JUnit as @AntonLitvinenko suggested. My question about it here.



            I added this dependency to fix it (see the issue):



            <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-test</artifactId>
            <version>2.12.0</version>
            <exclusions>
            <exclusion>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            </exclusion>
            </exclusions>
            <scope>test</scope>
            </dependency>


            Also, I used 2.0.1 version for kafka-junit and kafka_2.11:



            <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.11</artifactId>
            <version>$kafkaVersion</version>
            <scope>test</scope>
            </dependency>



            OLD



            I decided to use another Kafka-JUnit library by Salesforce. I added this group of dependencies:



            <!-- Declare kafka-junit4 dependency -->
            <dependency>
            <groupId>com.salesforce.kafka.test</groupId>
            <artifactId>kafka-junit4</artifactId>
            <version>3.1.1</version>
            <scope>test</scope>
            </dependency>

            <!-- Include Kafka 2.0.x -->
            <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.11</artifactId>
            <version>2.0.1</version>
            <scope>test</scope>
            </dependency>
            <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-clients</artifactId>
            <version>2.0.1</version>
            <scope>test</scope>
            </dependency>


            And now my test works well.



            You can see the usage instructions of this library here.



            I tried to increase Kafka version to 2.1.1 and I have an exception:




            java.lang.NoClassDefFoundError: scala/Function1




            So, I think the main problem is used Kafka version.






            share|improve this answer





























              0














              UPD



              I got an exception using Kafka for JUnit as @AntonLitvinenko suggested. My question about it here.



              I added this dependency to fix it (see the issue):



              <dependency>
              <groupId>org.apache.curator</groupId>
              <artifactId>curator-test</artifactId>
              <version>2.12.0</version>
              <exclusions>
              <exclusion>
              <groupId>org.apache.zookeeper</groupId>
              <artifactId>zookeeper</artifactId>
              </exclusion>
              </exclusions>
              <scope>test</scope>
              </dependency>


              Also, I used 2.0.1 version for kafka-junit and kafka_2.11:



              <dependency>
              <groupId>org.apache.kafka</groupId>
              <artifactId>kafka_2.11</artifactId>
              <version>$kafkaVersion</version>
              <scope>test</scope>
              </dependency>



              OLD



              I decided to use another Kafka-JUnit library by Salesforce. I added this group of dependencies:



              <!-- Declare kafka-junit4 dependency -->
              <dependency>
              <groupId>com.salesforce.kafka.test</groupId>
              <artifactId>kafka-junit4</artifactId>
              <version>3.1.1</version>
              <scope>test</scope>
              </dependency>

              <!-- Include Kafka 2.0.x -->
              <dependency>
              <groupId>org.apache.kafka</groupId>
              <artifactId>kafka_2.11</artifactId>
              <version>2.0.1</version>
              <scope>test</scope>
              </dependency>
              <dependency>
              <groupId>org.apache.kafka</groupId>
              <artifactId>kafka-clients</artifactId>
              <version>2.0.1</version>
              <scope>test</scope>
              </dependency>


              And now my test works well.



              You can see the usage instructions of this library here.



              I tried to increase Kafka version to 2.1.1 and I have an exception:




              java.lang.NoClassDefFoundError: scala/Function1




              So, I think the main problem is used Kafka version.






              share|improve this answer



























                0












                0








                0







                UPD



                I got an exception using Kafka for JUnit as @AntonLitvinenko suggested. My question about it here.



                I added this dependency to fix it (see the issue):



                <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-test</artifactId>
                <version>2.12.0</version>
                <exclusions>
                <exclusion>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
                </exclusion>
                </exclusions>
                <scope>test</scope>
                </dependency>


                Also, I used 2.0.1 version for kafka-junit and kafka_2.11:



                <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka_2.11</artifactId>
                <version>$kafkaVersion</version>
                <scope>test</scope>
                </dependency>



                OLD



                I decided to use another Kafka-JUnit library by Salesforce. I added this group of dependencies:



                <!-- Declare kafka-junit4 dependency -->
                <dependency>
                <groupId>com.salesforce.kafka.test</groupId>
                <artifactId>kafka-junit4</artifactId>
                <version>3.1.1</version>
                <scope>test</scope>
                </dependency>

                <!-- Include Kafka 2.0.x -->
                <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka_2.11</artifactId>
                <version>2.0.1</version>
                <scope>test</scope>
                </dependency>
                <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>2.0.1</version>
                <scope>test</scope>
                </dependency>


                And now my test works well.



                You can see the usage instructions of this library here.



                I tried to increase Kafka version to 2.1.1 and I have an exception:




                java.lang.NoClassDefFoundError: scala/Function1




                So, I think the main problem is used Kafka version.






                share|improve this answer















                UPD



                I got an exception using Kafka for JUnit as @AntonLitvinenko suggested. My question about it here.



                I added this dependency to fix it (see the issue):



                <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-test</artifactId>
                <version>2.12.0</version>
                <exclusions>
                <exclusion>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
                </exclusion>
                </exclusions>
                <scope>test</scope>
                </dependency>


                Also, I used 2.0.1 version for kafka-junit and kafka_2.11:



                <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka_2.11</artifactId>
                <version>$kafkaVersion</version>
                <scope>test</scope>
                </dependency>



                OLD



                I decided to use another Kafka-JUnit library by Salesforce. I added this group of dependencies:



                <!-- Declare kafka-junit4 dependency -->
                <dependency>
                <groupId>com.salesforce.kafka.test</groupId>
                <artifactId>kafka-junit4</artifactId>
                <version>3.1.1</version>
                <scope>test</scope>
                </dependency>

                <!-- Include Kafka 2.0.x -->
                <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka_2.11</artifactId>
                <version>2.0.1</version>
                <scope>test</scope>
                </dependency>
                <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>2.0.1</version>
                <scope>test</scope>
                </dependency>


                And now my test works well.



                You can see the usage instructions of this library here.



                I tried to increase Kafka version to 2.1.1 and I have an exception:




                java.lang.NoClassDefFoundError: scala/Function1




                So, I think the main problem is used Kafka version.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 27 at 12:10

























                answered Mar 26 at 16:51









                Daria PydorenkoDaria Pydorenko

                1,0742 gold badges6 silver badges33 bronze badges




                1,0742 gold badges6 silver badges33 bronze badges


















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360327%2fhow-to-fix-kafka-for-junit-dependencies-problem%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript