Kafka
  1. Kafka
  2. KAFKA-259

Give better error message when trying to run shell scripts without having built/downloaded the jars yet

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.8.0
    • Fix Version/s: 0.8.0
    • Component/s: None
    • Labels:
    • Environment:
      Mac OSX Lion

      Description

      Hi there, I've cloned from the kafka github repo and tried to run the start server script:

      ./bin/kafka-server-start.sh config/server.properties

      Which results in:

      Exception in thread "main" java.lang.NoClassDefFoundError: kafka/Kafka
      Caused by: java.lang.ClassNotFoundException: kafka.Kafka
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

      It seems that Im missing a build step? what have I forgotten to do?

      Thanks in advance and I look forward to using kafka.

      regards
      rcdh

      1. KAFKA-259-v2.patch
        1.0 kB
        Ashwanth F
      2. KAFKA-259-v1.patch
        2 kB
        Ashwanth F

        Activity

        Jun Rao made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Fix Version/s 0.8 [ 12317244 ]
        Resolution Fixed [ 1 ]
        Hide
        Jun Rao added a comment -

        Thanks for patch v2. +1. Committed to 0.8.

        Show
        Jun Rao added a comment - Thanks for patch v2. +1. Committed to 0.8.
        Ashwanth F made changes -
        Attachment KAFKA-259-v2.patch [ 12585326 ]
        Hide
        Ashwanth F added a comment -

        Jun Rao - I executed the simple contributor workflow in this page (https://cwiki.apache.org/confluence/display/KAFKA/Git+Workflow) again. Attached the patch. Can you please try again?

        Show
        Ashwanth F added a comment - Jun Rao - I executed the simple contributor workflow in this page ( https://cwiki.apache.org/confluence/display/KAFKA/Git+Workflow ) again. Attached the patch. Can you please try again?
        Hide
        Jun Rao added a comment -

        Thanks for the patch. It doesn't apply to 0.8 though. Could you provide another patch?

        git apply ~/Downloads/KAFKA-259-v1.patch
        /Users/jrao/Downloads/KAFKA-259-v1.patch:21: trailing whitespace.
        if [ $exitval -eq "1" ] ; then
        /Users/jrao/Downloads/KAFKA-259-v1.patch:27: trailing whitespace.
        if [[ -n "$match" ]]; then
        error: patch failed: bin/kafka-run-class.sh:81
        error: bin/kafka-run-class.sh: patch does not apply
        error: patch failed: bin/kafka-run-class.sh:93
        error: bin/kafka-run-class.sh: patch does not apply

        Show
        Jun Rao added a comment - Thanks for the patch. It doesn't apply to 0.8 though. Could you provide another patch? git apply ~/Downloads/ KAFKA-259 -v1.patch /Users/jrao/Downloads/ KAFKA-259 -v1.patch:21: trailing whitespace. if [ $exitval -eq "1" ] ; then /Users/jrao/Downloads/ KAFKA-259 -v1.patch:27: trailing whitespace. if [[ -n "$match" ]]; then error: patch failed: bin/kafka-run-class.sh:81 error: bin/kafka-run-class.sh: patch does not apply error: patch failed: bin/kafka-run-class.sh:93 error: bin/kafka-run-class.sh: patch does not apply
        Hide
        Ashwanth F added a comment -

        I have submitted a patch for this. Basically the patch checks whether the java process returns with an exit code of 1 (abnormal), and if it does checks the output of the java process to see whether there are NoClassDefFoundError or "Could not find or load main class" messages and then if it does, displays this message:

        "Please build the project using sbt. Documentation is available at http://kafka.apache.org/"

        Please let me know if you have any concerns with this approach.

        Show
        Ashwanth F added a comment - I have submitted a patch for this. Basically the patch checks whether the java process returns with an exit code of 1 (abnormal), and if it does checks the output of the java process to see whether there are NoClassDefFoundError or "Could not find or load main class" messages and then if it does, displays this message: "Please build the project using sbt. Documentation is available at http://kafka.apache.org/ " Please let me know if you have any concerns with this approach.
        Ashwanth F made changes -
        Attachment KAFKA-259-v1.patch [ 12583908 ]
        Hide
        Ashwanth F added a comment -

        Hi, I have a patch for this, I am going through legal to get it approved. Will upload it here asap.

        Show
        Ashwanth F added a comment - Hi, I have a patch for this, I am going through legal to get it approved. Will upload it here asap.
        Ashwanth F made changes -
        Attachment KAFKA-259-v1.patch [ 12583526 ]
        Ashwanth F made changes -
        Comment [ Hi,
             I have submitted a patch for this. Basically the patch checks whether the java process returns with an exit code of 1 (abnormal), and if it does checks the output of the java process to see whether there are NoClassDefFoundError or "Could not find or load main class" messages and then if it does, displays this message:

        "Please build the project using sbt. Documentation is available at http://kafka.apache.org/"

        Please let me know if you have any concerns with this approach. Thanks for all your help. ]
        Ashwanth F made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Affects Version/s 0.8 [ 12317244 ]
        Affects Version/s 0.6 [ 12317242 ]
        Ashwanth F made changes -
        Attachment KAFKA-259-v1.patch [ 12583526 ]
        Ashwanth F made changes -
        Attachment KAFKA-259-v1.patch [ 12583239 ]
        Ashwanth F made changes -
        Comment [ Hi,
             I have submitted a patch for this. Basically the patch checks whether the java process returns with an exit code of 1 (abnormal), and if it does checks the output of the java process to see whether there are NoClassDefFoundError or "Could not find or load main class" messages and then if it does, displays this message:

        "Please build the project using sbt. Documentation is available at http://kafka.apache.org/"

        Please let me know if you have any concerns with this approach. ]
        Ashwanth F made changes -
        Attachment KAFKA-259-v1.patch [ 12583239 ]
        Ashwanth F made changes -
        Attachment KAFKA-259-v1.patch [ 12583233 ]
        Ashwanth F made changes -
        Attachment KAFKA-259-v1.patch [ 12583233 ]
        Hide
        Ross Crawford-d'Heureuse added a comment -

        @jay, absolutely no problem mate, sorry if I sounded snooty was not meant as such. As far as I can see maven +- sbt are really good tools. But for a rank noob with java its a case of figuring out the nomenclature and processes that is the java world lol

        Show
        Ross Crawford-d'Heureuse added a comment - @jay, absolutely no problem mate, sorry if I sounded snooty was not meant as such. As far as I can see maven +- sbt are really good tools. But for a rank noob with java its a case of figuring out the nomenclature and processes that is the java world lol
        Hide
        Jay Kreps added a comment -

        Yeah, I didn't mean that in a snotty way, just that if we version control the jars the java people get all sulky and complain that we aren't using maven to download them, but if we do that then the non-maven people are unhappy because nothing works.

        Show
        Jay Kreps added a comment - Yeah, I didn't mean that in a snotty way, just that if we version control the jars the java people get all sulky and complain that we aren't using maven to download them, but if we do that then the non-maven people are unhappy because nothing works.
        Hide
        Ross Crawford-d'Heureuse added a comment -

        as a noob to java/scala I can honestly say that it may be covered in the readme but there is allot of forest in there and not many trees to be seen its just the basics (and probably only form my point of view) thanks for your time and effort guys and keep up the great work!

        Show
        Ross Crawford-d'Heureuse added a comment - as a noob to java/scala I can honestly say that it may be covered in the readme but there is allot of forest in there and not many trees to be seen its just the basics (and probably only form my point of view) thanks for your time and effort guys and keep up the great work!
        Jay Kreps made changes -
        Field Original Value New Value
        Summary Exception in thread "main" java.lang.NoClassDefFoundError: kafka/Kafka Caused by: java.lang.ClassNotFoundException: kafka.Kafka Give better error message when trying to run shell scripts without having built/downloaded the jars yet
        Labels newbie
        Hide
        Jay Kreps added a comment -

        This is covered in the README and the releases come with packaged jars. The only thing I think we could do better is error out if there are no jars in dist, let's change this bug to be about doing that.

        Show
        Jay Kreps added a comment - This is covered in the README and the releases come with packaged jars. The only thing I think we could do better is error out if there are no jars in dist, let's change this bug to be about doing that.
        Hide
        Joe Stein added a comment -

        cd kafka
        ./sbt update
        ./sbt package

        this will make the jars for you to be able to run the server as you are attempting to-do

        Show
        Joe Stein added a comment - cd kafka ./sbt update ./sbt package this will make the jars for you to be able to run the server as you are attempting to-do
        Ross Crawford-d'Heureuse created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Ross Crawford-d'Heureuse
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development