当前位置: 首页 > 知识库问答 >
问题:

Jenkins-爪哇。lang.IllegalArgumentException:最后一个单元没有足够的有效位

东门玺
2023-03-14

Jenkins2.176.4-3轧制

Gradle 4.3.1

问题领域:给定单个Gradle任务的并行运行(或者它可以是任何简单的操作),尤其是在运行基于Jenkinsfile的管道的并发运行时

突然间,我在Jenkins日志页面中发现了这个错误,以前从未见过这个错误(在Jenkins中也没有发现这个错误的stackoverflow帖子)。

错误:java。lang.IllegalArgumentException:最后一个单元没有足够的有效位

再次只运行了一次Jenkinsfile管道(它在多个项目中并行运行一个Gradle任务(比方说:rpm任务)),并成功运行了!!;检查成功运行和失败运行之间传递的参数/值-它们相似。

Jenkinsfile示例可以在这里找到:Jenkinsfile Pipeline DSL:如何在Jobs dashboard GUI中显示多个列——对于所有动态创建的阶段——当我在管道部分中并行运行gradle任务(比如gradle rpm)时(通过创建动态阶段,每个gradlerpm任务在单个stage step中运行)(这样我就不会为每个项目在Jenkinsfile中硬编码)。

注意:在Jenkinsfile中,尽管gradle任务rpm(我在单独的阶段并行运行)(在阶段下)部分定义了有效的gradle任务,即rpm,但似乎gradle任务在多个项目上并行运行(Jenkinsfile中的部分)并不是每次都100%成功,至少是Gradle 4.3.1,因为我也看到了另一个错误:

05:31:41 FAILURE: Build failed with an exception.
05:31:42 
05:31:42 * What went wrong:
05:31:42 Task 'null' not found in root project 'T000123_ABCD_Project'.
05:31:42 

本期海报上的内容与此类似:发行4.10.2后的gradle期


这是堆栈跟踪中显示Jenkins完整错误日志

 Oops!

A problem occurred while processing the request.
        Please check our bug tracker to see if a similar problem has already been reported.
        If it is already reported, please vote and put a comment on it to let us gauge the impact of the problem.
        If you think this is a new issue, please file a new issue.
        When you file an issue, make sure to add the entire stack trace, along with the version of Jenkins and relevant plugins.
        The users list might be also useful in understanding what has happened.
Stack trace

java.lang.IllegalArgumentException: Last unit does not have enough valid bits
    at java.util.Base64$Decoder.decode0(Base64.java:734)
    at java.util.Base64$Decoder.decode(Base64.java:526)
    at hudson.util.UnbufferedBase64InputStream.read(UnbufferedBase64InputStream.java:41)
    at hudson.util.UnbufferedBase64InputStream.read(UnbufferedBase64InputStream.java:53)
    at java.io.DataInputStream.readFully(DataInputStream.java:195)
    at java.io.DataInputStream.readFully(DataInputStream.java:169)
    at hudson.console.ConsoleNote.readFrom(ConsoleNote.java:258)
    at hudson.console.ConsoleAnnotationOutputStream.eol(ConsoleAnnotationOutputStream.java:111)
    at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
    at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
    at java.io.FilterOutputStream.write(FilterOutputStream.java:77)
    at org.jenkinsci.plugins.workflow.log.FileLogStorage$1$1.write(FileLogStorage.java:238)
    at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
    at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:89)
    at org.kohsuke.stapler.framework.io.LargeText$HeadMark.moveTo(LargeText.java:314)
    at org.kohsuke.stapler.framework.io.LargeText.writeLogTo(LargeText.java:229)
    at hudson.console.AnnotatedLargeText.writeRawLogTo(AnnotatedLargeText.java:168)
    at org.jenkinsci.plugins.workflow.log.FileLogStorage$1.writeHtmlTo(FileLogStorage.java:203)
    at hudson.console.AnnotatedLargeText.writeLogTo(AnnotatedLargeText.java:147)
    at org.kohsuke.stapler.framework.io.LargeText.doProgressText(LargeText.java:264)
    at hudson.console.AnnotatedLargeText.doProgressiveHtml(AnnotatedLargeText.java:95)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
    at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
Caused: javax.servlet.ServletException
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:797)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.MetaClass$2.doDispatch(MetaClass.java:219)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:456)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:280)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:280)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
    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:873)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
    at com.cloudbees.jenkins.support.impl.cloudbees.UnrestrictedApiCallsMonitor$ApiMonitorFilter.doFilter(UnrestrictedApiCallsMonitor.java:120)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
    at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:243)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
    at com.cloudbees.jenkins.support.slowrequest.SlowRequestFilter.doFilter(SlowRequestFilter.java:37)
    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 io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
    at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
    at jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
    at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
    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:1610)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:99)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    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:1610)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
    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:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1701)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:502)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:745)


是什么让我在Jenkins中收到这个错误消息?

错误:java。lang.IllegalArgumentException:最后一个单元没有足够的有效位


为什么我的管道运行会断断续续地失败,并在Gradle中出现以下错误消息(当并行部分用于在Jenkinsfile中运行某些内容(即Gradle一些任务)时/代码>)?

在根项目中找不到任务null



当运行此管道的许多并发运行(在并行中的许多项目上运行Gradle任务)时,假设我启动了4个管道运行,每个运行正在构建3-5个项目的Gradlerpm任务),然后我看到了以下与FILE锁定相关的问题。

https://stackoverflow.com/a/59828842/1499296

i、 e.Gradle无法删除文件夹/文件(如下所列)

**Execution failed for task ':clean'.
> Unable to delete directory: /some/path/build/someFolder/aFolder_or_File **

由于等待锁定文件哈希缓存超时,无法捕获任务的输出文件快照

Failed to capture snapshot of output files for task ':rpm' property 'archivePath' during up-to-date check.

> Timeout waiting to lock file hash cache (/view/user123456_Team_Tools/vobs/space/test/folder1/Project1of5/.gradle/4.3.1/fileHashes). It is currently in use by another Gradle instance.

  Owner PID: 29003

  Our PID: 903

  Owner Operation: 

  Our operation: 

  Lock file: /view/user123456_Team_Tools/vobs/space/test/folder1/Project1of5/.gradle/4.3.1/fileHashes/fileHashes.lock

获取:无法使用BuildScopeS创建ScriptPluginFactory类型的服务ervices.createScriptPluginFactory()

17:40:11 FAILURE: Build failed with an exception.
17:40:11 
17:40:11 * What went wrong:
17:40:11 Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
17:40:11 > Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().

无法读取路径'/一些/jenkins/workspace/path//a/作业/文件夹/子文件夹/file.class_or_any_extension'

JAVA伊奥。FileNotFoundException,即无法找到文件(如果我只运行此管道的一次运行,则Gradle成功生成)。

17:38:28 * What went wrong:
17:38:28 Execution failed for task ':rpm'.
17:38:28 > java.io.FileNotFoundException: '/some/jenkins/workspace/path/of/a/job/folder/sub-folder/artifact-1.0.0.121.rpm' 

共有1个答案

吕永寿
2023-03-14

在单管道运行的情况下,如果您有更多的项目(比如20个项目),并且您正在并行运行Gradle someTask(无论是在单个阶段还是每个项目的单个阶段),然后您可以设置GRADLE\u USER\u HOME=$工作区/${whichProject}文件夹(其中${whichProject}是一个项目文件夹,您可以在Jenkins工作区中使用它(在git clone或类似的签出操作之后)。这可能会解决任何并行任务运行时遇到的任何锁定相关问题,但代价是影响Gradle的性能(即在许多项目的并行任务运行中不使用Gradle缓存)。

动态创建的唯一Jenkins工作区内设置唯一的GRADLE\u USER\u HOME值(每个项目)(例如:Jenkins/workspace/jobname/

  1. i、 e.这样做,Project1将使用GRADLE\u USER\u HOME=/jenkins/Workspace/jobname/

我注意到CLI选项--gradle user home(又名$gradle\u user\u home)在运行gradle任务时只设置为Jenkins的工作区示例值,因此,所有3-5个project的Gradle任务(在我的情况下是rpm任务)运行都是在并行(使用同一服务帐户的Gradle缓存文件夹)中运行的,该文件夹通常位于Gradle\u USER\u主位置下(因此在我的情况下,所有3-5个项目共享单个Gradle的缓存文件夹以进行并行任务运行)。

我仍在试图找到解决方案,以解决在运行并行管道运行时(在单个管道运行中,每个项目再次运行并行的Gradle任务),每个都使用各自不同的Jenkins WORKSPACE文件夹,为什么我仍然遇到这些问题;如果找到解决方案,我会更新。

 类似资料:
  • 我试图用我的gradle项目运行junit测试,但不管是什么测试,它们都会抛出以下堆栈跟踪 我已经看到了一些建议的解决方案,但似乎没有一个奏效。当我在ant中运行它们时,我的测试运行良好。我已经确保xerces使用的是最新版本,我还添加了建议的版本 对于JVM,但似乎什么都不起作用。 任何建议都将不胜感激。我可以根据要求提供更多信息。 **更新** 做了以下更改- 但现在的结果如图所示 **更新2

  • 问题内容: 流没有方法: 获取最后一个元素(或对于空Stream为null)的最优雅和/或最有效的方法是什么? 问题答案: 做一个简单地返回当前值的归约:

  • Stream没有方法: 获取最后一个元素(或空流为null)的最优雅和/或最有效的方法是什么?

  • 问题内容: 我正在尝试使用RestTemplate这样执行URL- 但是每次我遇到这样的错误- 我在做什么错以及如何解决? 更新:- 我也尝试过使用该网址,但它对我没有用。我刚刚更换用 更新2 这是代码- 错误是- 问题答案: 似乎没有办法忽略它。而是根据您的值生成一个(不使用double )。 并使用需要使用的重载方法。

  • 我目前正在尝试创建带有python文件和大量额外软件包的docker映像。txt。 当我运行命令“sudo docker build-t XXX”时软件包被一个接一个地下载和安装,直到我收到一个错误:“由于环境错误,无法安装软件包:[Errno 28]设备上没有剩余空间” 我已经做了“sudo docker system prune”的原子选项,所有过去的docker镜像都被删除了。 此外,“su

  • 如果您打开枚举,但既不涵盖所有情况也不提供默认值,则获取编译器警告很有用。本网站上的其他答案建议javac应该提供这样的警告。 我正在使用Maven,并在pom.xml中添加了以下内容,试图启用所有警告: 但是编译器仍然对我的代码中的非exhasting switch语句保持沉默。我是否可以设置其他标志来启用此类警告?