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

InvocationTargetException when connecting to Bitbucket server with an empty repo

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: blueocean-plugin
    • Labels:
      None
    • Environment:
      Jenkins:
      Core 2.109 with BO 1.5.0-beta-1
      All other plugins at experimental update center levels
    • Sprint:
      Blue Ocean 1.5 - beta 2
    • Similar Issues:

      Description

      Summary:
      After upgrading to 1.5-beta-1, I've seen twice now an InvocationTargetException when attempting connecting to a Bitbucket server to which I'd previously connected.

      Frequency of Occurrence:
      100% reproducible so far.

      Steps to recreate:
      0. Optional: assuming you've got filesystem access to your Jenkins server, run tail -f /var/log/jenkins/jenkins.log so you can monitor the Jenkins log in real time.

      1. Given an existing Jenkins installation with BO 1.4.x installed, take the 1.5.0-beta-1 upgrade. The Jenkins instance should be already connected to a Bitbucket server.

      2. Create an empty repository on this same Bitbucket server, using the flow in the BBS UI. Make no commits to it - my thinking was that I could build the repo from nothing, using the edtor. It'll look something like this when you're done:

      3. Create a new pipeline, and pick the "Project" in which you created the new repo. In my case this project is called "February." Tthe loading wheel will get stuck at this loading wheel for many minutes:

      4. Take a look at the output from the Jenkins log you started tailing in step 0, and you'll see the InvocationTargetException being thrown:

      Feb 27, 2018 2:47:26 AM io.jenkins.blueocean.commons.stapler.export.ExportInterceptor$1 getValue
      WARNING: Failed to get "repositories" from a io.jenkins.blueocean.blueocean_bitbucket_pipeline.BitbucketRepositoryContainer
      java.lang.reflect.InvocationTargetException
      	at io.jenkins.blueocean.commons.stapler.export.MethodProperty.getValue(MethodProperty.java:74)
      	at io.jenkins.blueocean.commons.stapler.export.ExportInterceptor$1.getValue(ExportInterceptor.java:46)
      	at io.jenkins.blueocean.commons.stapler.Export$BlueOceanExportInterceptor.getValue(Export.java:167)
      	at io.jenkins.blueocean.commons.stapler.export.Property.writeTo(Property.java:136)
      	at io.jenkins.blueocean.commons.stapler.export.Model.writeNestedObjectTo(Model.java:228)
      	at io.jenkins.blueocean.commons.stapler.export.Model.writeNestedObjectTo(Model.java:224)
      	at io.jenkins.blueocean.commons.stapler.export.Model.writeTo(Model.java:199)
      	at io.jenkins.blueocean.commons.stapler.Export.writeOne(Export.java:148)
      	at io.jenkins.blueocean.commons.stapler.Export.serveExposedBean(Export.java:139)
      	at io.jenkins.blueocean.commons.stapler.Export.doJson(Export.java:79)
      	at io.jenkins.blueocean.commons.stapler.TreeResponse$Processor$1.generateResponse(TreeResponse.java:48)
      	at org.kohsuke.stapler.HttpResponseRenderer$Default.handleHttpResponse(HttpResponseRenderer.java:124)
      	at org.kohsuke.stapler.HttpResponseRenderer$Default.generateResponse(HttpResponseRenderer.java:69)
      	at org.kohsuke.stapler.Function.renderResponse(Function.java:136)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:119)
      	at org.kohsuke.stapler.IndexDispatcher.dispatch(IndexDispatcher.java:26)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$3.doDispatch(MetaClass.java:209)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$3.doDispatch(MetaClass.java:209)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:686)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	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:841)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
      	at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
      	at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
      	at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:105)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:564)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      	at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
      	at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
      	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: io.jenkins.blueocean.commons.ServiceException$UnexpectedErrorException: No content to map due to end-of-input
       at [Source: UNKNOWN; line: 1, column: 0]
      	at io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerApi.getDefaultBranch(BitbucketServerApi.java:293)
      	at io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbRepo.toScmRepository(BbRepo.java:63)
      	at io.jenkins.blueocean.blueocean_bitbucket_pipeline.BitbucketRepositoryContainer$BitbucketRepositories.<init>(BitbucketRepositoryContainer.java:82)
      	at io.jenkins.blueocean.blueocean_bitbucket_pipeline.BitbucketRepositoryContainer.getRepositories(BitbucketRepositoryContainer.java:41)
      	at io.jenkins.blueocean.commons.stapler.export.MethodProperty.getValue(MethodProperty.java:72)
      	... 118 more
      Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
       at [Source: UNKNOWN; line: 1, column: 0]
      	at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
      	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3854)
      	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799)
      	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2931)
      	at io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerApi.getDefaultBranch(BitbucketServerApi.java:290)
      	... 122 more
      

        Attachments

          Activity

          Hide
          kshultz Karl Shultz added a comment -

          Once a Jenkinsfile is added to this empty repository, everything goes back to working fine.

          Show
          kshultz Karl Shultz added a comment - Once a Jenkinsfile is added to this empty repository, everything goes back to working fine.
          Hide
          vivek Vivek Pandey added a comment -

          Karl Shultz what version of bb server it is? Does it also happen with Bb cloud? Don’t think anything changed in this last of the code though. 

          Show
          vivek Vivek Pandey added a comment - Karl Shultz what version of bb server it is? Does it also happen with Bb cloud? Don’t think anything changed in this last of the code though. 
          Hide
          vivek Vivek Pandey added a comment -

          Karl Shultz followed your steps with BB server 5.2.0 and it worked fine with brand new empty repo. I suspect it might be a later version of BB server with something in response that blueocean BB server code is not handling properly. Let us know what version of BB server you see this issue. 

          Show
          vivek Vivek Pandey added a comment - Karl Shultz followed your steps with BB server 5.2.0 and it worked fine with brand new empty repo. I suspect it might be a later version of BB server with something in response that blueocean BB server code is not handling properly. Let us know what version of BB server you see this issue. 
          Hide
          vivek Vivek Pandey added a comment -

          Missed this error in the log:

          Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
           at [Source: UNKNOWN; line: 1, column: 0]
          	at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
          	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3854)
          	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799)
          	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2931)
          	at io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerApi.getDefaultBranch(BitbucketServerApi.java:290)
          

          Looks like for empty repo we are expecting HTTP status 404 but getting 204 when we call default branch API. This change happened in BB server 5.6.0, https://jira.atlassian.com/browse/BSERV-10313.

          PR opened: https://github.com/jenkinsci/blueocean-plugin/pull/1678.

          Show
          vivek Vivek Pandey added a comment - Missed this error in the log: Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input at [Source: UNKNOWN; line: 1, column: 0] at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3854) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2931) at io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerApi.getDefaultBranch(BitbucketServerApi.java:290) Looks like for empty repo we are expecting HTTP status 404 but getting 204 when we call default branch API. This change happened in BB server 5.6.0, https://jira.atlassian.com/browse/BSERV-10313 . PR opened: https://github.com/jenkinsci/blueocean-plugin/pull/1678 .

            People

            • Assignee:
              vivek Vivek Pandey
              Reporter:
              kshultz Karl Shultz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: