Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-14024

KMS JMX endpoint throws ClassNotFoundException

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.8.0
    • Fix Version/s: 2.9.0, 2.8.2
    • Component/s: kms
    • Labels:
      None

      Description

      Throws like this:

      </pre></p><p><b>root cause</b> <pre>java.lang.ClassNotFoundException: org.mortbay.jetty.servlet.Context
      	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1698)
      	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1544)
      	org.apache.hadoop.jmx.JMXJsonServlet.doGet(JMXJsonServlet.java:174)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
      	org.apache.hadoop.crypto.key.kms.server.KMSMDCFilter.doFilter(KMSMDCFilter.java:84)
      	org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:636)
      	org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter.doFilter(DelegationTokenAuthenticationFilter.java:304)
      	org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:588)
      	org.apache.hadoop.crypto.key.kms.server.KMSAuthenticationFilter.doFilter(KMSAuthenticationFilter.java:129)
      

      I tried out branch-2.6 and it seems to be okay, so something changed between 2.6.x and 2.8.x/branch-2

        Issue Links

          Activity

          Hide
          andrew.wang Andrew Wang added a comment -

          Works in branch-2.7 also, which narrows the diff.

          Show
          andrew.wang Andrew Wang added a comment - Works in branch-2.7 also, which narrows the diff.
          Hide
          jzhuge John Zhuge added a comment -

          This looks the same as HADOOP-13872.

          Show
          jzhuge John Zhuge added a comment - This looks the same as HADOOP-13872 .
          Hide
          xiaochen Xiao Chen added a comment -

          This looks the same as HADOOP-13872.

          Not exactly, because that jira allegedly only affecting 3.0, and with HADOOP-13597 that's be taken care of.
          Here the problem is on branch-2, so needs investigation.

          Show
          xiaochen Xiao Chen added a comment - This looks the same as HADOOP-13872 . Not exactly, because that jira allegedly only affecting 3.0, and with HADOOP-13597 that's be taken care of. Here the problem is on branch-2, so needs investigation.
          Hide
          jzhuge John Zhuge added a comment - - edited

          Fixed after changing this section in JMXJsonServlet.java:

                if (!HttpServer2.isStaticUserAndNoneAuthType(servletContext, request) &&
                    !isInstrumentationAccessAllowed(request, response)) {
          

          to

                if (!isInstrumentationAccessAllowed(request, response)) {
          

          HADOOP-13707 introduced kms dependency on jetty via calling HttpServer2.isStaticUserAndNoneAuthType in JMXJsonServlet.doGet.

          Show
          jzhuge John Zhuge added a comment - - edited Fixed after changing this section in JMXJsonServlet.java: if (!HttpServer2.isStaticUserAndNoneAuthType(servletContext, request) && !isInstrumentationAccessAllowed(request, response)) { to if (!isInstrumentationAccessAllowed(request, response)) { HADOOP-13707 introduced kms dependency on jetty via calling HttpServer2.isStaticUserAndNoneAuthType in JMXJsonServlet.doGet .
          Hide
          jzhuge John Zhuge added a comment -

          Patch branch-2.001

          • Change Maven dependency of jetty from "test" to "compile"

          Testing Done

          Show
          jzhuge John Zhuge added a comment - Patch branch-2.001 Change Maven dependency of jetty from "test" to "compile" Testing Done KMS sanity tests including JMX /kms/jmx
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 13m 14s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 test4tests 0m 1s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
          +1 mvninstall 7m 27s branch-2 passed
          +1 compile 6m 22s branch-2 passed with JDK v1.8.0_131
          +1 compile 7m 17s branch-2 passed with JDK v1.7.0_131
          +1 mvnsite 0m 24s branch-2 passed
          +1 javadoc 0m 13s branch-2 passed with JDK v1.8.0_131
          +1 javadoc 0m 14s branch-2 passed with JDK v1.7.0_131
          +1 mvninstall 0m 19s the patch passed
          +1 compile 7m 22s the patch passed with JDK v1.8.0_131
          +1 javac 7m 22s the patch passed
          +1 compile 7m 41s the patch passed with JDK v1.7.0_131
          +1 javac 7m 41s the patch passed
          +1 mvnsite 0m 24s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 xml 0m 1s The patch has no ill-formed XML file.
          +1 javadoc 0m 12s the patch passed with JDK v1.8.0_131
          +1 javadoc 0m 14s the patch passed with JDK v1.7.0_131
          +1 unit 1m 46s hadoop-kms in the patch passed with JDK v1.7.0_131.
          +1 asflicense 0m 23s The patch does not generate ASF License warnings.
          56m 13s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:5e40efe
          JIRA Issue HADOOP-14024
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12874973/HADOOP-14024-branch-2.001.patch
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit xml
          uname Linux 44300d1c4ebe 3.13.0-116-generic #163-Ubuntu SMP Fri Mar 31 14:13:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision branch-2 / c5f43fe
          Default Java 1.7.0_131
          Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_131 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_131
          JDK v1.7.0_131 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/12655/testReport/
          modules C: hadoop-common-project/hadoop-kms U: hadoop-common-project/hadoop-kms
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/12655/console
          Powered by Apache Yetus 0.5.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 13m 14s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 0m 1s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 mvninstall 7m 27s branch-2 passed +1 compile 6m 22s branch-2 passed with JDK v1.8.0_131 +1 compile 7m 17s branch-2 passed with JDK v1.7.0_131 +1 mvnsite 0m 24s branch-2 passed +1 javadoc 0m 13s branch-2 passed with JDK v1.8.0_131 +1 javadoc 0m 14s branch-2 passed with JDK v1.7.0_131 +1 mvninstall 0m 19s the patch passed +1 compile 7m 22s the patch passed with JDK v1.8.0_131 +1 javac 7m 22s the patch passed +1 compile 7m 41s the patch passed with JDK v1.7.0_131 +1 javac 7m 41s the patch passed +1 mvnsite 0m 24s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 xml 0m 1s The patch has no ill-formed XML file. +1 javadoc 0m 12s the patch passed with JDK v1.8.0_131 +1 javadoc 0m 14s the patch passed with JDK v1.7.0_131 +1 unit 1m 46s hadoop-kms in the patch passed with JDK v1.7.0_131. +1 asflicense 0m 23s The patch does not generate ASF License warnings. 56m 13s Subsystem Report/Notes Docker Image:yetus/hadoop:5e40efe JIRA Issue HADOOP-14024 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12874973/HADOOP-14024-branch-2.001.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit xml uname Linux 44300d1c4ebe 3.13.0-116-generic #163-Ubuntu SMP Fri Mar 31 14:13:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision branch-2 / c5f43fe Default Java 1.7.0_131 Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_131 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_131 JDK v1.7.0_131 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/12655/testReport/ modules C: hadoop-common-project/hadoop-kms U: hadoop-common-project/hadoop-kms Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/12655/console Powered by Apache Yetus 0.5.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          xiaochen Xiao Chen added a comment -

          Thanks John Zhuge for chasing this down! +1 to the fix.

          I also manually verified the jmx to show correctly.

          Show
          xiaochen Xiao Chen added a comment - Thanks John Zhuge for chasing this down! +1 to the fix. I also manually verified the jmx to show correctly.
          Hide
          jzhuge John Zhuge added a comment -

          Committed to branch-2 and branch-2.8.

          Thanks Xiao Chen for the discussion and review! Thanks Andrew Wang for reporting the issue.

          Show
          jzhuge John Zhuge added a comment - Committed to branch-2 and branch-2.8. Thanks Xiao Chen for the discussion and review! Thanks Andrew Wang for reporting the issue.
          Hide
          jzhuge John Zhuge added a comment -

          Just a little explanation on the fix:

          Show
          jzhuge John Zhuge added a comment - Just a little explanation on the fix: Changing jetty scope from "test" to "compile" is a lie technically because only KMS test code depends on jetty directly, while KMS main code depends on jetty indirectly via hadoop-common. Even if I remove the jetty exclusion from hadoop-common dependency, the local jetty test dependency will trump the transitive jetty compile dependency. See http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope .

            People

            • Assignee:
              jzhuge John Zhuge
              Reporter:
              andrew.wang Andrew Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development