Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20163

java.lang.NoClassDefFoundError: sun/net/www/protocol/jar/JarURLConnection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: core
    • Environment:
      Wildfly 8.0.0.Beta1
      Linux 3.11.0-12-generic
      Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18
      Jenkins 1.536
    • Similar Issues:

      Description

      when i upgrade from 1.535 to 1.536 and open the webpage all static ressources are not displayed and in the server log the follwoing shows up:

      2013-10-22 08:53:49,653 ERROR [io.undertow.servlet] (Handling GET /jenkins/static/389b820a/plugin/translation/flags.png : default task-34) Error while serving http://localhost/jenkins/static/389b820a/plugin/translation/flags.png: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:297) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:160) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:95) [stapler-1.221.jar:]
      at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:370) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:727) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:841) [stapler-1.221.jar:]
      at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:248) [stapler-1.221.jar:]
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:727) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:841) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:630) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Stapler.service(Stapler.java:224) [stapler-1.221.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Beta1.jar:1.0.0.Beta1]
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:87) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96) [jenkins-core-1.536.jar:]
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88) [jenkins-core-1.536.jar:]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48) [jenkins-core-1.536.jar:]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) [jenkins-core-1.536.jar:]
      at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51) [jenkins-core-1.536.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117) [jenkins-core-1.536.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) [acegi-security-1.0.7.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) [acegi-security-1.0.7.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) [acegi-security-1.0.7.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174) [acegi-security-1.0.7.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:64) [jenkins-core-1.536.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) [acegi-security-1.0.7.jar:]
      at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) [jenkins-core-1.536.jar:]
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [jenkins-core-1.536.jar:]
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) [jenkins-core-1.536.jar:]
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164) [jenkins-core-1.536.jar:]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46) [stapler-1.221.jar:]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) [jenkins-core-1.536.jar:]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:93) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:81)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:55) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:65) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:218) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:205) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:69) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:134) [undertow-servlet-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.server.HttpHandlers.executeRootHandler(HttpHandlers.java:36) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:619) [undertow-core-1.0.0.Beta17.jar:1.0.0.Beta17]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
      at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
      Caused by: java.lang.NoClassDefFoundError: sun/net/www/protocol/jar/JarURLConnection
      at org.kohsuke.stapler.Stapler$OpenConnection.getLastModified(Stapler.java:273) [stapler-1.221.jar:]
      at org.kohsuke.stapler.Stapler.serveStaticResource(Stapler.java:394) [stapler-1.221.jar:]
      at org.kohsuke.stapler.ResponseImpl.serveLocalizedFile(ResponseImpl.java:210) [stapler-1.221.jar:]
      at hudson.Plugin.doDynamic(Plugin.java:222) [jenkins-core-1.536.jar:]
      ... 78 more

      sitching back to 1.535 the issue is gone, this also shows up for me on a fresh installation

        Attachments

          Issue Links

            Activity

            Hide
            fjtc Fabio Chino added a comment -

            This issue is also affecting version 1.537 on Ubuntu 12.04 (x64) with openjdk-6 and JBoss 7.1.1. As stated by Michael Cramer, version 1.535 is working perfectly.

            The stack trace indicates that the root problem is a NoClassDefFoundError for the class sun.net.www.protocol.jar.JarURLConnection inside the class org.kohsuke.stapler.Stapler.

            Looking inside the code (https://github.com/stapler/stapler/blame/master/core/src/main/java/org/kohsuke/stapler/Stapler.java), it was possible to see that the dependency on the class sun.net.www.protocol.jar.JarURLConnection was added by the revision:

            05e5dbd5 » kohsuke
            2013-10-09 JENKINS-14336

            Since the class sun.net.www.protocol.jar.JarURLConnection is proprietary class that may not be available in the all JVM, I think JBoss class loader is filtering, leading to the NoClassDefFoundError.

            A fast look into the code shows that no method available only to sun.net.www.protocol.jar.JarURLConnection is called by the method Stapler.getLastModified() so I think it is possible to replace it by its parent class java.net.JarURLConnection from the standard Java classpath, solving the problem.

            This can be achieved by changing the line:

            import sun.net.www.protocol.jar.JarURLConnection;

            to

            import java.net.JarURLConnection;

            No further changes appears to be required.

            Please notice that I didn't have time to test it myself so I'm not sure if this fix will work or not.

            Show
            fjtc Fabio Chino added a comment - This issue is also affecting version 1.537 on Ubuntu 12.04 (x64) with openjdk-6 and JBoss 7.1.1. As stated by Michael Cramer, version 1.535 is working perfectly. The stack trace indicates that the root problem is a NoClassDefFoundError for the class sun.net.www.protocol.jar.JarURLConnection inside the class org.kohsuke.stapler.Stapler. Looking inside the code ( https://github.com/stapler/stapler/blame/master/core/src/main/java/org/kohsuke/stapler/Stapler.java ), it was possible to see that the dependency on the class sun.net.www.protocol.jar.JarURLConnection was added by the revision: 05e5dbd5 » kohsuke 2013-10-09 JENKINS-14336 Since the class sun.net.www.protocol.jar.JarURLConnection is proprietary class that may not be available in the all JVM, I think JBoss class loader is filtering, leading to the NoClassDefFoundError . A fast look into the code shows that no method available only to sun.net.www.protocol.jar.JarURLConnection is called by the method Stapler.getLastModified() so I think it is possible to replace it by its parent class java.net.JarURLConnection from the standard Java classpath, solving the problem. This can be achieved by changing the line: import sun.net.www.protocol.jar.JarURLConnection; to import java.net.JarURLConnection; No further changes appears to be required. Please notice that I didn't have time to test it myself so I'm not sure if this fix will work or not.
            Hide
            jglick Jesse Glick added a comment -

            https://github.com/stapler/stapler/issues/28 fixed but would need to be integrated in Jenkins. Probably only affects certain app servers?

            Show
            jglick Jesse Glick added a comment - https://github.com/stapler/stapler/issues/28 fixed but would need to be integrated in Jenkins. Probably only affects certain app servers?
            Hide
            eocampos Eliseo Ocampos added a comment -

            JBoss 7.1.1 is affected too, I integrated Stapler 1.223-SNAPSHOT into Jenkins 1.540-SNAPSHOT and the problem went away.

            Show
            eocampos Eliseo Ocampos added a comment - JBoss 7.1.1 is affected too, I integrated Stapler 1.223-SNAPSHOT into Jenkins 1.540-SNAPSHOT and the problem went away.
            Hide
            jglick Jesse Glick added a comment -

            I tried to do a Stapler release but release:perform failed with an exception which is a mystery to me:

            [INFO] [ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.4.4:deploy (injected-nexus-deploy) on project stapler-parent: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.4.4:deploy failed: A required class was missing while executing org.sonatype.plugins:nexus-staging-maven-plugin:1.4.4:deploy: org/sonatype/aether/version/InvalidVersionSpecificationException
            

            (Something incompatible with Maven 3.1.0 perhaps?)

            So we are still waiting for @kohsuke to please publish this.

            Show
            jglick Jesse Glick added a comment - I tried to do a Stapler release but release:perform failed with an exception which is a mystery to me: [INFO] [ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.4.4:deploy (injected-nexus-deploy) on project stapler-parent: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.4.4:deploy failed: A required class was missing while executing org.sonatype.plugins:nexus-staging-maven-plugin:1.4.4:deploy: org/sonatype/aether/version/InvalidVersionSpecificationException (Something incompatible with Maven 3.1.0 perhaps?) So we are still waiting for @kohsuke to please publish this.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            changelog.html
            core/pom.xml
            http://jenkins-ci.org/commit/jenkins/d8eca0f5e7f8c57bf991039d8d255640547ed237
            Log:
            [FIXED JENKINS-20163]

            Integrated the fix in Stapler.

            Compare: https://github.com/jenkinsci/jenkins/compare/53317a8045ec...d8eca0f5e7f8

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html core/pom.xml http://jenkins-ci.org/commit/jenkins/d8eca0f5e7f8c57bf991039d8d255640547ed237 Log: [FIXED JENKINS-20163] Integrated the fix in Stapler. Compare: https://github.com/jenkinsci/jenkins/compare/53317a8045ec...d8eca0f5e7f8
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #3052
            [FIXED JENKINS-20163] (Revision d8eca0f5e7f8c57bf991039d8d255640547ed237)

            Result = SUCCESS
            kohsuke : d8eca0f5e7f8c57bf991039d8d255640547ed237
            Files :

            • changelog.html
            • core/pom.xml
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #3052 [FIXED JENKINS-20163] (Revision d8eca0f5e7f8c57bf991039d8d255640547ed237) Result = SUCCESS kohsuke : d8eca0f5e7f8c57bf991039d8d255640547ed237 Files : changelog.html core/pom.xml
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            core/pom.xml
            http://jenkins-ci.org/commit/jenkins/7d602d52b4459143a4901c246206fbc7a505143d
            Log:
            [FIXED JENKINS-20163]

            Integrated the fix in Stapler.

            (cherry picked from commit d8eca0f5e7f8c57bf991039d8d255640547ed237)

            Conflicts:
            changelog.html
            core/pom.xml

            Compare: https://github.com/jenkinsci/jenkins/compare/3286d960d65b...7d602d52b445

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/pom.xml http://jenkins-ci.org/commit/jenkins/7d602d52b4459143a4901c246206fbc7a505143d Log: [FIXED JENKINS-20163] Integrated the fix in Stapler. (cherry picked from commit d8eca0f5e7f8c57bf991039d8d255640547ed237) Conflicts: changelog.html core/pom.xml Compare: https://github.com/jenkinsci/jenkins/compare/3286d960d65b...7d602d52b445

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                bigmichi1 Michael Cramer
              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: