Jenkins Error: Powershell Integration with Jenkins - powershell

I mm trying to integrate PowerShell with Jenkins. I am finding it hard to resolve this error as my PowerShell script job is failing as shown below.
[own-machine-powershell-job] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Windows\TEMP\hudson3566059468296731803.ps1'"
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "powershell.exe" (in directory "C:\jenkins\workspace\own-machine-powershell-job"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.(Proc.java:244)
at hudson.Proc$LocalProc.(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:120)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
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:62)
at java.lang.Thread.run(Unknown Source)
at ......remote call to Powershell-Job(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
at hudson.remoting.Channel.call(Channel.java:781)
at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
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:785)
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:408)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.(Proc.java:244)
at hudson.Proc$LocalProc.(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:120)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
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:62)
at java.lang.Thread.run(Unknown Source)
Build step 'Windows PowerShell' marked build as failure
Finished: FAILURE

My recommendation is to check this locally before trying in jenkins.
If you tried to use the plugin or to execute an external file try to re-check the file path:
The system cannot find the file specified FATAL: command execution failed java.io.IOException: Cannot run program "powershell.exe"
The powershell exe path is wrong.

I got it resolved finally.
Basically, in my system environment variables, powershell.exe path was incorrect which I corrected it. Then ran my Jenkins job, but still the same error.
So, I restarted my system, then ran my Jenkins Powershell Job successfully.
Thanks

Not sure if this will help anyone else but gonna write it down just for posterity. Make sure your slave is running and connected. I saw this error when my Windows Jenkins slave had been disconnected, but I hadn't set a "restrict where this build can run" so it was running on my master (a Linux machine). Obviously it couldn't find a powershell.exe on there. :D

Related

Error when packaging EXE file using Netbeans

I am doing a project on Netbeans and trying to package an exe file and below is the error. I found some related topics to this, but none of them work for me. Can someone help me with this, please?
Thanks.
java.io.IOException: Exec failed with code 2 command [[C:\Program Files (x86)\Inno Setup 6\iscc.exe, /oC:\Users\kenny\Documents\NetBeansProjects\MyRebarsProject\dist\bundles, C:\Users\kenny\AppData\Local\Temp\fxbundler2533082479821554529\images\win-exe.image\MyRebarsProject.iss] in C:\Users\kenny\AppData\Local\Temp\fxbundler2533082479821554529\images\win-exe.image
at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:165)
at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:138)
at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:132)
at com.oracle.tools.packager.windows.WinExeBundler.buildEXE(WinExeBundler.java:697)
at com.oracle.tools.packager.windows.WinExeBundler.bundle(WinExeBundler.java:366)
at com.oracle.tools.packager.windows.WinExeBundler.execute(WinExeBundler.java:173)
at com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:352)
at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:319)
at com.sun.javafx.tools.ant.DeployFXTask.execute(DeployFXTask.java:286)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at jdk.nashorn.internal.scripts.Script$75$\^eval\_.:program(<eval>:225)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at sun.reflect.GeneratedMethodAccessor192.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.util.ReflectUtil.invoke(ReflectUtil.java:109)
at org.apache.tools.ant.util.ReflectWrapper.invoke(ReflectWrapper.java:81)
at org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:103)
at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:67)
at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
C:\Users\kenny\Documents\NetBeansProjects\MyRebarsProject\nbproject\build-native.xml:736: Error: Bundler "EXE Installer" (exe) failed to produce a bundle.
BUILD FAILED (total time: 3 seconds)
It's fixed. Actually I had to reinstall Inno Setup 6 and add it to the path again.

Scala FileNotFoundException

While doing I/O in Scala using Cygwin, I have copied data at this location:
/cygdrive/c/DataResearch/retail_db/order_items/part-00000
but when I am trying to access the file from the Scala prompt with the following command I get this error:
val orderItems = Source
.fromFile("/cygdrive/c/DataResearch/retail_db/order_items/part-00000")
Error:
java.i[![enter image description here][1]][1]o.FileNotFoundException: \c\DataResearch\retail_db\order_items\part-
00000
(The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at scala.io.Source$.fromFile(Source.scala:91)
at scala.io.Source$.fromFile(Source.scala:76)
at scala.io.Source$.fromFile(Source.scala:54)
What can I try to resolve this?

Installing ritz-nrepl for emacs

I'm trying to setup ritz-nrepl to use emacs as a clojure debugger.
I have lein 2. I got emacs 24.2.1 (fresh install) and clojure-mode. Then I did what the readme says here https://github.com/pallet/ritz/tree/develop/nrepl under nREPL debugger installation (putting stuff in init.el and .lein/profiles.clj) and then did M-x nrepl-ritz-jack-in. I got the output below. Am I doing something wrong? I have only done what I said, nothing more. Maybe I'm missing a step?
Could not find artifact robert:hooke:jar:1.1.2 in central (http://repo1.maven.org/maven2)
Retrieving robert/hooke/1.1.2/hooke-1.1.2.jar (3k)from https://clojars.org/repo/
Retrieving leiningen/leiningen/2.0.0-preview10/leiningen-2.0.0-preview10.jar (165k)
from https://clojars.org/repo/
Retrieving leiningen-core/leiningen-core/2.0.0-preview10/leiningen-core-2.0.0-preview10.jar (21k)
from https://clojars.org/repo/
Exception in thread "main" java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at ritz.jpda.jdi$eval1039$loading__4784__auto____1040.invoke(jdi.clj:1)
at ritz.jpda.jdi$eval1039.invoke(jdi.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at ritz.jpda.debug$eval888$loading__4784__auto____889.invoke(debug.clj:1)
at ritz.jpda.debug$eval888.invoke(debug.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:605)
at clojure.core$use.doInvoke(core.clj:5392)
at clojure.lang.RestFn.invoke(RestFn.java:3659)
at ritz.nrepl$eval5$loading__4784__auto____6.invoke(nrepl.clj:1)
at ritz.nrepl$eval5.invoke(nrepl.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval1.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Subprocess failed
I think you're missing tools.jar from the classpath, you'll find it in the lib directory of your JDK (not JRE).
If anyone else has this problem this is how I solved it
(it was a little more complicated than just installing the JDK)
Install the JDK. I put it in C:\jdk1.7.0
Use lein-localrepo to install it as a local jar as follows:
Add :plugins [[lein-localrepo "0.4.0"]] to your user profile in .lein\profiles.clj
lein deps
lein localrepo install "C:/jdk1.7.0/lib/tools.jar" "com.sun.jdi.VirtualMachine" 1.7.0
Make sure lein-localrepo can find the jar. lein localrepo list | grep jdi should show: com.sun.jdi.VirtualMachine (1.7.0)
Add :dependencies [[com.sun.jdi.VirtualMachine "1.7.0"]] to your user profile
lein deps
In emacs, nrepl-ritz-jack-in should now work correctly

why doesnt webappcreator run?

I'm just running thru the instructions here on windows:
https://developers.google.com/web-toolkit/gettingstarted
$ ./webAppCreator -out MyWebApp com.mycompany.mywebapp.MyWebApp
java.lang.NoClassDefFoundError: com/google/gwt/user/tools/WebAppCreator
Caused by: java.lang.ClassNotFoundException: com.google.gwt.user.tools.WebAppCreator
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.google.gwt.user.tools.WebAppCreator. Program will exit.
Exception in thread "main"
Try adding the folder where webAppCreator is to your PATH variable so you can run without needing to be in that folder ... Also you prob dont use Cygwin, but don't use cygwin command line and use the regular Windows command line (I had same error when using Cygwin)

Not able to run CTS on Windows

when I run: java %JAVA_OPTS% -cp %JARS%(jar_files) com.android.cts.TestHost %CONFIG%(xml path) %* %DDCONFIG%
in cmd promt im getting following error, please anybody suggest solution for this error
Exception in thread "main" java.lang.NoClassDefFoundError: and
Caused by: java.lang.ClassNotFoundException: and
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: and. Program will exit.
Package com.android.cts.TestHost is exists in Jar file.which
I had the same issue by using cygwin
I found the solution on this blog
You just have to do the modification of those two line in the script startcts :
JARS=`cygpath -w -p ${CTS_LIB}:${DDM_LIB}:${JUNIT_LIB}:${HOSTTEST_LIB}`
java ${JAVA_OPTS} -cp ${JARS} com.android.cts.TestHost `cygpath -w ${CONFIG}` "$#" ${DDCONFIG}
Then I was able to have the CTS prompt