2015-10-14 199 views
4

我試圖從運行在Windows從一詹金斯工作的一些基本批處理命令,但似乎詹金斯無法安裝JDK。詹金斯從無法安裝JDK

因爲它說CreateProcess error=740, The requested operation requires elevation我試圖運行被記錄在從管理員和無更迭完全禁用UAC在Windows中。

上得到這個工作的任何線索?我正在運行Windows 8.

編輯: 我試圖設置C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk始終以所有用戶的管理員身份運行。這沒有幫助。當我嘗試在cmd.exe本地運行jdk時,它運行時沒有錯誤。

下面是完整的堆棧跟蹤:

Installing C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe 
[Java_SE_Development_Kit_8u60] $ C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60 /L C:\Jenkins\tools\hudson.model.JDK\install4140010637459422013log 
Unknown error (0x2e4) 
FATAL: command execution failed 
java.io.IOException: Cannot run program "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe" (in directory "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60"): CreateProcess error=740, The requested operation requires elevation 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at hudson.Proc$LocalProc.<init>(Proc.java:244) 
    at hudson.Proc$LocalProc.<init>(Proc.java:216) 
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:382) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:121) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:49) 
    at hudson.remoting.Request$2.run(Request.java:326) 
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at hudson.remoting.Engine$1$1.run(Engine.java:69) 
    at java.lang.Thread.run(Unknown Source) 
    at ......remote call to ToonBed(Native Method) 
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1413) 
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:221) 
    at hudson.remoting.Channel.call(Channel.java:778) 
    at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:382) 
    at hudson.Launcher$ProcStarter.join(Launcher.java:389) 
    at hudson.tools.JDKInstaller.install(JDKInstaller.java:268) 
    at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:141) 
    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68) 
    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108) 
    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206) 
    at hudson.model.JDK.forNode(JDK.java:132) 
    at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:359) 
    at hudson.model.Run.getEnvironment(Run.java:2234) 
    at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935) 
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90) 
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66) 
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) 
    at hudson.model.Build$BuildExecution.build(Build.java:205) 
    at hudson.model.Build$BuildExecution.doRun(Build.java:162) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) 
    at hudson.model.Run.execute(Run.java:1741) 
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
    at hudson.model.ResourceController.execute(ResourceController.java:98) 
    at hudson.model.Executor.run(Executor.java:381) 
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elevation 
    at java.lang.ProcessImpl.create(Native Method) 
    at java.lang.ProcessImpl.<init>(Unknown Source) 
    at java.lang.ProcessImpl.start(Unknown Source) 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at hudson.Proc$LocalProc.<init>(Proc.java:244) 
    at hudson.Proc$LocalProc.<init>(Proc.java:216) 
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:382) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:121) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:49) 
    at hudson.remoting.Request$2.run(Request.java:326) 
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at hudson.remoting.Engine$1$1.run(Engine.java:69) 
    at java.lang.Thread.run(Unknown Source) 
Build step 'Execute Windows batch command' marked build as failure 
Robot results publisher started... 
-Parsing output xml: 
Installing C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe 
[Java_SE_Development_Kit_8u60] $ C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60 /L C:\Jenkins\tools\hudson.model.JDK\install2992849421630137437log 
Failed! 
java.io.IOException: Cannot run program "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe" (in directory "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60"): CreateProcess error=740, The requested operation requires elevation 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at hudson.Proc$LocalProc.<init>(Proc.java:244) 
    at hudson.Proc$LocalProc.<init>(Proc.java:216) 
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:382) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:121) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:49) 
    at hudson.remoting.Request$2.run(Request.java:326) 
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at hudson.remoting.Engine$1$1.run(Engine.java:69) 
    at java.lang.Thread.run(Unknown Source) 
    at ......remote call to ToonBed(Native Method) 
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1413) 
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:221) 
    at hudson.remoting.Channel.call(Channel.java:778) 
    at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:382) 
    at hudson.Launcher$ProcStarter.join(Launcher.java:389) 
    at hudson.tools.JDKInstaller.install(JDKInstaller.java:268) 
    at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:141) 
    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68) 
    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108) 
    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206) 
    at hudson.model.JDK.forNode(JDK.java:132) 
    at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:359) 
    at hudson.model.Run.getEnvironment(Run.java:2234) 
    at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935) 
    at hudson.plugins.robot.RobotPublisher.perform(RobotPublisher.java:234) 
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726) 
    at hudson.model.Build$BuildExecution.post2(Build.java:185) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671) 
    at hudson.model.Run.execute(Run.java:1766) 
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
    at hudson.model.ResourceController.execute(ResourceController.java:98) 
    at hudson.model.Executor.run(Executor.java:381) 
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elevation 
    at java.lang.ProcessImpl.create(Native Method) 
    at java.lang.ProcessImpl.<init>(Unknown Source) 
    at java.lang.ProcessImpl.start(Unknown Source) 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at hudson.Proc$LocalProc.<init>(Proc.java:244) 
    at hudson.Proc$LocalProc.<init>(Proc.java:216) 
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:382) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149) 
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:121) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:49) 
    at hudson.remoting.Request$2.run(Request.java:326) 
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at hudson.remoting.Engine$1$1.run(Engine.java:69) 
    at java.lang.Thread.run(Unknown Source) 
Finished: FAILURE 
+0

禁用UAC只會刪除對話框,它不會以管理員身份運行所有程序 –

+0

即使您是管理員,您仍然需要右鍵單擊並以管理員身份運行 –

+0

嘿。我只是想檢查你是否最終找到了解決方案。 – Alexander

回答

0

好像你沒有訪問這些文件。也許以管理員身份運行或更改所有者?

+0

我試過了,沒有用。 – Toon

0

一個可能的解決方案,我知道是有必要在某些情況下,是通過使管理員權限:創建快捷方式的可執行文件,然後右鍵單擊快捷方式 - >屬性 - >高級 - >選擇「以管理員身份運行」。然後,只需在腳本中指定快捷方式,交叉手指並在椅子上旋轉3次即可。

(編輯由於可怕的語法。)

+1

由於這個命令由Jenkins運行,所以我無法真正將它指向快捷方式。 – Toon

+0

放眼一點,你有點兒不對;自動化快捷方式有點棘手,但仍然有可能,請參閱:[link](http:// stackoverflow。COM /問題/ 6139365 /執行的快捷鏈接,從-A-批處理文件和不要等待換應用到出口)。無可否認,在這個階段它開始變得駭人聽聞,特別是如果你必須開始向PATH添加變量。 :/ –

0

可能有幾種可能的方式來解決這個問題。
在詹金斯論壇
https://wiki.jenkins.io/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM

最終什麼工作,我提到了
詹金斯需要完全訪問WBEM腳本定位符(HKEY_CLASSES_ROOT \ CLSID {76A64158-CB41-11D1-8B02-00600806D9B6})。
只讀取管理員組的默認值。
因此,我們需要將管理員組的權限更改爲「完全控制」。
1.啓動 '器regedit.exe' 爲 '管理員'
2.找到以下注冊表項:HKEY_CLASSES_ROOT \ CLSID \ {76A64158-CB41-11D1-8B02-00600806D9B6}
3.右鍵單擊並選擇 '權限'
4.將所有者更改爲管理員組。
5.更改管理員組的權限 - >授予完全控制權限。
6.將所有者更改回的TrustedInstaller(用戶是「NT服務\的TrustedInstaller」)
7.重新啓動遠程註冊表服務
8. http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5582上的從安裝vcredist 2008
9.確保Java可執行文件被設置在路徑。