Hudson failing to start

▼魔方 西西 提交于 2020-01-05 12:28:49

问题


I had hudson running on windows server successfully. needed to restart the hudson service. After restart i am getting below error. Any idea, or if anybody experienced this issue.

org.jvnet.hudson.reactor.ReactorException:     com.google.common.util.concurrent.UncheckedExecutionException:     java.lang.NullPointerException
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:246)
    at hudson.model.Hudson.executeReactor(Hudson.java:719)
    at hudson.model.Hudson.<init>(Hudson.java:616)
    at org.eclipse.hudson.init.InitialRunnable.run(InitialRunnable.java:51)
    at java.lang.Thread.run(Thread.java:619)
Caused by: com.google.common.util.concurrent.UncheckedExecutionException:     java.lang.NullPointerException
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2263)
    at com.google.common.cache.LocalCache.get(LocalCache.java:4000)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4004)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4874)
    at hudson.model.TopLevelItemsCache.get(TopLevelItemsCache.java:78)
    at hudson.model.LazyTopLevelItem.item(LazyTopLevelItem.java:144)
    at hudson.model.LazyTopLevelItem.hasPermission(LazyTopLevelItem.java:271)
    at hudson.model.Hudson.getItems(Hudson.java:1303)
    at hudson.model.Hudson.getItems(Hudson.java:223)
    at hudson.model.Hudson.getAllItems(Hudson.java:1367)
    at hudson.model.DependencyGraph.<init>(DependencyGraph.java:78)
    at hudson.model.Hudson.rebuildDependencyGraph(Hudson.java:3626)
    at hudson.model.Hudson$12.run(Hudson.java:2415)
    at     org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
    at hudson.model.Hudson$4.runTask(Hudson.java:699)
    at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
    at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
    at     java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    ... 1 more
Caused by: java.lang.NullPointerException
    at hudson.model.RunMap.recalcLastStable(RunMap.java:469)
    at hudson.model.RunMap.recalcMarkers(RunMap.java:209)
    at hudson.model.RunMap.setBuilds(RunMap.java:199)
    at hudson.model.RunMap.putAllRunValues(RunMap.java:225)
    at hudson.model.RunMap.reset(RunMap.java:292)
    at hudson.model.RunMap.load(RunMap.java:640)
    at hudson.model.AbstractProject.onLoad(AbstractProject.java:329)
    at hudson.model.BaseBuildableProject.onLoad(BaseBuildableProject.java:91)
    at hudson.model.TopLevelItemsCache$1.load(TopLevelItemsCache.java:64)
    at hudson.model.TopLevelItemsCache$1.load(TopLevelItemsCache.java:57)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3599)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2379)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2342)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2257)
    ... 20 more

Greatly appreciate help !!


回答1:


I had a similar problem. There was power outage and some files get corrupted. It was possible to start Hudson without any job (I moved all jobs to different directory).

So I went through latest modified jobs in $HUDSON_HOME/jobs and deleted

  • empty nextBuildNumber file
  • empty builds/_runmap.xml file
  • whole build with empty build.xml and/or changelog.xml files (builds/yyyy-MM-ss_HH-mm-ss directory and builds/xxx link)



回答2:


Here's a quick hack we used when we ran into the same situation:

#!/usr/bin/env python
"""Remove references from missing builds from all _runmap.xml files"""
from xml.dom.minidom import parse, parseString
import os
import glob

for buildRoot in glob.glob("/var/lib/hudson/jobs/*/builds/"):
    runmapFilename = buildRoot + "/_runmap.xml"
    if not os.path.exists(runmapFilename):
        continue

    dom = parse(runmapFilename)
    builds = dom.getElementsByTagName("builds")[0]
    changed = False
    for build in builds.getElementsByTagName("build"):
        buildDir = build.getElementsByTagName("buildDir")[0].childNodes[0].data
        if not os.path.exists(buildRoot + "/" + buildDir + "/build.xml"):
            changed = True
            print "missing", buildRoot, buildDir
            builds.removeChild(build)

    if changed:
        os.rename(runmapFilename, runmapFilename + ".org")
        f = open(runmapFilename, "w")
        f.write(dom.toxml())
        f.close()



回答3:


I unfortunately it seems that the history is lost for the jobs that are corrupted.

In order have back online hudson I have done the following:

  • removed builds folder entirely
  • removed the link to the lastS*
  • set nextBuildNumber to 1

I hope this help.



来源:https://stackoverflow.com/questions/22380712/hudson-failing-to-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!