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

Illegal state exception if navigating pages during Jenkins 2.0 startup

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core

      Jenkins layouts must not invoke getActiveInstance() during the startup.

      Mar 22, 2016 5:26:51 PM org.eclipse.jetty.util.log.JavaUtilLog warn
      WARNING: EXCEPTION 
      javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/var/cache/jenkins/war/WEB-INF/lib/jenkins-core-2.0-alpha-5-SNAPSHOT.jar!/lib/layout/layout.jelly:161:89: <j:invokeStatic> method getActiveInstance threw exception: Jenkins has not been started, or was already shut down
      	at org.kohsuke.stapler.jelly.JellyRequestDispatcher.forward(JellyRequestDispatcher.java:60)
      	at hudson.util.HudsonIsRestarting.doDynamic(HudsonIsRestarting.java:45)
      	at sun.reflect.GeneratedMethodAccessor169.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:324)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100)
      	at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:403)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:595)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:191)
      	at org.eclipse.jetty.server.Dispatcher.error(Dispatcher.java:77)
      	at org.eclipse.jetty.server.handler.ErrorHandler.handle(ErrorHandler.java:92)
      	at org.eclipse.jetty.server.Response.sendError(Response.java:597)
      	at org.eclipse.jetty.server.Response.sendError(Response.java:544)
      	at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)
      	at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:857)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      	at hudson.init.impl.InstallUncaughtExceptionHandler$1.reportException(InstallUncaughtExceptionHandler.java:27)
      	at org.kohsuke.stapler.compression.CompressionFilter.reportException(CompressionFilter.java:77)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:55)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:499)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/var/cache/jenkins/war/WEB-INF/lib/jenkins-core-2.0-alpha-5-SNAPSHOT.jar!/lib/layout/layout.jelly:161:89: <j:invokeStatic> method getActiveInstance threw exception: Jenkins has not been started, or was already shut down
      	at org.apache.commons.jelly.tags.core.InvokeStaticTag.doTag(InvokeStaticTag.java:148)
      	at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      	at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      	at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
      	at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      	at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
      	at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      	at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      	at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:120)
      	at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      	at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      	at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:95)
      	at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
      	at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:53)
      	at org.kohsuke.stapler.jelly.JellyRequestDispatcher.forward(JellyRequestDispatcher.java:55)
      	... 58 more
      Caused by: java.lang.IllegalStateException: Jenkins has not been started, or was already shut down
      	at jenkins.model.Jenkins.getActiveInstance(Jenkins.java:726)
      	at sun.reflect.GeneratedMethodAccessor166.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.apache.commons.jelly.tags.core.InvokeStaticTag.doTag(InvokeStaticTag.java:125)
      	... 72 more
      

          [JENKINS-33728] Illegal state exception if navigating pages during Jenkins 2.0 startup

          Oleg Nenashev added a comment - - edited

          Oleg Nenashev added a comment - - edited cause: https://github.com/jenkinsci/jenkins/commit/036a8e94ed37cf851f0cafb9cb12c21e3496ed7c by tfennelly ]

          Tom FENNELLY added a comment -

          kzantow Could this be as a result of the new changes for security setup? I seem to remember there was some behind the scenes changes to the Jenkins instance (I thought we suspected that might cause issues) while the installer is setting up security.

          Tom FENNELLY added a comment - kzantow Could this be as a result of the new changes for security setup? I seem to remember there was some behind the scenes changes to the Jenkins instance (I thought we suspected that might cause issues) while the installer is setting up security.

          Keith Zantow added a comment -

          tfennelly this isn't related to the setup wizard AFAIK, the changed you mentioned were removed anyway, startup is mostly as it was wrt. setup wizard changes.

          Keith Zantow added a comment - tfennelly this isn't related to the setup wizard AFAIK, the changed you mentioned were removed anyway, startup is mostly as it was wrt. setup wizard changes.

          Keith Zantow added a comment -

          oleg_nenashev could you provide any more info on this – was this after plugin installations and a restart? what platform?

          Keith Zantow added a comment - oleg_nenashev could you provide any more info on this – was this after plugin installations and a restart? what platform?

          Oleg Nenashev added a comment -

          kzantow I've updated the issue's environment section. It has happened after the first start after WAR replacement from 1.642.2. I've pressed "Install recommended plugin", then the instance has been restarted with this error

          Oleg Nenashev added a comment - kzantow I've updated the issue's environment section. It has happened after the first start after WAR replacement from 1.642.2. I've pressed "Install recommended plugin", then the instance has been restarted with this error

          Code changed in jenkins
          User: kzantow
          Path:
          core/src/main/resources/lib/layout/layout.jelly
          http://jenkins-ci.org/commit/jenkins/8f094a41bc94053403bf65cac5f9183a192ce03a
          Log:
          JENKINS-33728 - Remove stray getActiveInstance call in layout.jelly

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: kzantow Path: core/src/main/resources/lib/layout/layout.jelly http://jenkins-ci.org/commit/jenkins/8f094a41bc94053403bf65cac5f9183a192ce03a Log: JENKINS-33728 - Remove stray getActiveInstance call in layout.jelly

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/resources/lib/layout/layout.jelly
          http://jenkins-ci.org/commit/jenkins/ef24fd6a76e348b78fd57bbd3cf41b6fbf42f230
          Log:
          Merge pull request #2164 from kzantow/JENKINS-33728-dont-call-getactiveinstance-in-layoutjelly

          JENKINS-33728 - Remove stray getActiveInstance call in layout.jelly

          Compare: https://github.com/jenkinsci/jenkins/compare/6a355ae3dfb9...ef24fd6a76e3

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/resources/lib/layout/layout.jelly http://jenkins-ci.org/commit/jenkins/ef24fd6a76e348b78fd57bbd3cf41b6fbf42f230 Log: Merge pull request #2164 from kzantow/ JENKINS-33728 -dont-call-getactiveinstance-in-layoutjelly JENKINS-33728 - Remove stray getActiveInstance call in layout.jelly Compare: https://github.com/jenkinsci/jenkins/compare/6a355ae3dfb9...ef24fd6a76e3

          Keith Zantow added a comment -

          oleg_nenashev could you validate the fix for this at your convenience?

          Keith Zantow added a comment - oleg_nenashev could you validate the fix for this at your convenience?

          Daniel Beck added a comment -

          I'm pretty sure this is fixed.

          Daniel Beck added a comment - I'm pretty sure this is fixed.

            kzantow Keith Zantow
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: