Access windows command from Linux using Ant tasks - linux

Can someone share the code for invoking an ant file in remote Windows server through an ant task?
I am executing ant from Linux in my /home/user directory.
An sshexec task tries in my build xml on linux server tries to run a remote windows command:
<target name="Build">
<sshexec trust="yes" host="hostname.world.com" timeout="300000" username="username" password="password" command="ant -file run.xml" />
</target>
But I am getting this error:
Build:
[sshexec] Connecting to <<hostname>>:22
BUILD FAILED
/home/userId/BuildDir/run.xml:94: com.jcraft.jsch.JSchException: Session.connect: java.net.SocketException: Connection reset
at com.jcraft.jsch.Session.connect(Session.java:557)
at com.jcraft.jsch.Session.connect(Session.java:183)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:225)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:236)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
And sometimes the connection is successful, but I am wondering how to access folders in windows machine in my linux server build file.

Related

Invalid MIT-MAGIC-COOKIE-1 key

I get this error-"Invalid MIT-MAGIC-COOKIE-1 key"
when running a program with sudo in ubuntu
example-
sudo gedit /etc/profile...
without sudo, it runs fine...
gedit /etc/profile runs fine
also...
sudo ./studio.sh gives this error
No protocol specified
Start Failed: Internal Error. Failed to initialize graphics environment
java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:128)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
at java.awt.EventQueue.isDispatchThread(EventQueue.java:1049)
at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
at javax.swing.text.StyleContext.reclaim(StyleContext.java:454)
at javax.swing.text.StyleContext.addAttribute(StyleContext.java:311)
at javax.swing.text.html.StyleSheet.addAttribute(StyleSheet.java:578)
at javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.java:1501)
at javax.swing.text.StyleContext$NamedStyle.setName(StyleContext.java:1312)
at javax.swing.text.StyleContext$NamedStyle.<init>(StyleContext.java:1259)
at javax.swing.text.StyleContext.addStyle(StyleContext.java:107)
at javax.swing.text.StyleContext.<init>(StyleContext.java:87)
at javax.swing.text.html.StyleSheet.<init>(StyleSheet.java:166)
at javax.swing.text.html.HTMLEditorKit.getStyleSheet(HTMLEditorKit.java:391)
at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:102)
at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:74)
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 com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
at com.intellij.idea.Main.main(Main.java:86)
./studio.sh runs fine
how to solve this?
I got it solved using
xhost local:
in terminal
xhost local: is not secure if your machine can have multiple users (and even if it doesn't currently, that's a bad habit). Indeed, other local users could have access to your X server. Restrict the local connections to user root with:
xhost +si:localuser:root

Having trouble starting Jenkins: "java.io.FileNotFoundException: /usr/share/java/jenkins/war/META-INF/MANIFEST.MF (No such file or directory)"

I just downloaded the Jenkins WAR, version 1.651.1. I’m trying to set it up on my Amazon Linux box. I’m running Java 1.7. I moved the WAR into its own directory, /usr/share/java/jenkins, and then set JENKINS_HOME to be that directory. Then I ran the command listed here — https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins. Looked so simple on the web site. But I got the below error:
[davea#mydevbox ~]$ java -jar /usr/share/java/jenkins/jenkins.war
Running from: /usr/share/java/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Apr 19, 2016 9:29:34 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 19, 2016 9:29:34 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Apr 19, 2016 9:29:34 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.FileNotFoundException: /usr/share/java/jenkins/war/META-INF/MANIFEST.MF (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:280)
at winstone.HostConfiguration.<init>(HostConfiguration.java:83)
at winstone.HostGroup.initHost(HostGroup.java:66)
at winstone.HostGroup.<init>(HostGroup.java:45)
at winstone.Launcher.<init>(Launcher.java:145)
at winstone.Launcher.main(Launcher.java:356)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at Main._main(Main.java:307)
at Main.main(Main.java:98)
What else do I need to do to get Jenkins started?
Edit: Output in response to the suggestion given ...
[davea#mydevbox ~]$ sudo useradd jenkins
[davea#mydevbox ~]$ sudo chown -R jenkins:jenkins /usr/share/java/jenkins/jenkins.war
[davea#mydevbox ~]$
[davea#mydevbox ~]$ sudo su - jenkins
[jenkins#mydevbox ~]$ java -jar /usr/share/java/jenkins/jenkins.war
Running from: /usr/share/java/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Apr 21, 2016 4:46:08 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 21, 2016 4:46:08 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Apr 21, 2016 4:46:08 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.FileNotFoundException: /usr/java/jboss/standalone/deployments/jenkins.war/war/META-INF/MANIFEST.MF (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:280)
at winstone.HostConfiguration.<init>(HostConfiguration.java:83)
at winstone.HostGroup.initHost(HostGroup.java:66)
at winstone.HostGroup.<init>(HostGroup.java:45)
at winstone.Launcher.<init>(Launcher.java:145)
at winstone.Launcher.main(Launcher.java:356)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at Main._main(Main.java:307)
at Main.main(Main.java:98)
I think it is a permission related issue.
I guess the user and group owner isset to a different user than what jenkins was trying to run as. Try to set it correctly with:
$sudo chown -R <jenkins_user><jenkins_group> /usr/share/java/jenkins/
“java.io.FileNotFoundException: /usr/share/java/jenkins/war/META-INF/MANIFEST.MF (No such file or directory)”
Guys be chill.
Just run below command.
mkdir /var/cache/jenkins;chown jenkins:jenkins /var/cache/jenkins;
and the start the app.
I had exactly the same issue. Unable to change the user, I changed the hosted port by appending --httpPort=9090 to my java run command.
$ java -jar /usr/share/java/jenkins/jenkins.war --httpPort=9090
My two cents: not only must be jenkins user be the owner of $JENKINS_HOME, it looks like it also has to be the owner of jenkins.war (not just have access to it). Found out the hard way while configuring sytemd unit file for Jenkins.
Probably the userid that you are using is not the owner of JENKINS_HOME.
This has happened to me on Vagrant, when trying to use the jenkins user on a JENKINS_HOME owned by vagrant. jenkins did have write permissions to on JENKINS_HOME, but it is not enough: it has to be the owner.
I learned this because when I tried sudo -u jenkins touch file-in-jenkins-home I got touch: setting times (...): Operation not permitted. And then I found https://unix.stackexchange.com/questions/64848/cannot-touch-m-a-writable-file
In my case, I had this problem because a user named "jenkins" was already created on my Mac.
After:
uninstalling the broken Jenkins with '/Library/Application
Support/Jenkins/Uninstall.command',
removing the "jenkins" user,
and re-installing from https://jenkins.io/download
--> everything worked smoothly.
I was facing the same issue after i accidently deleted the cache from /var/cache/jenkins. I resolved it by manually creating the jenkins folder in /var/cache/ with the same permission which is there in /var/lib/jenkins and it worked.
I have an old jenkins version 1.641, and downloaded the war file of 2.240.1, when run
java -jar jenkins.war
I got similar errors:
java.io.FileNotFoundException:
c:\jenkins.jenkins\war\META-INF\MANIFEST.MF (Access is denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:278)
at winstone.HostConfiguration.(HostConfiguration.java:81)
at winstone.HostGroup.initHost(HostGroup.java:66)
at winstone.HostGroup.(HostGroup.java:45)
at winstone.Launcher.(Launcher.java:172)
at winstone.Launcher.main(Launcher.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:375)
at Main.main(Main.java:151) 2020-02-07 22:06:19.010+0000 [id=1] SEVERE winstone.Logger#logInternal: Container startup
failed java.io.FileNotFoundException:
c:\jenkins.jenkins\war\META-INF\MANIFEST.MF (Access is denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:278)
at winstone.HostConfiguration.(HostConfiguration.java:81)
at winstone.HostGroup.initHost(HostGroup.java:66)
at winstone.HostGroup.(HostGroup.java:45)
at winstone.Launcher.(Launcher.java:172)
at winstone.Launcher.main(Launcher.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:375)
at Main.main(Main.java:151)
it is found that the folder c:\jenkins\.jenkins\war did not exist.
After manually created the folder, the new Jenkins works.

Arch Linux ARMv7 - Pi4J build with maven failed at JNI

I am trying to build Pi4J on Raspberry Pi2 model B with Arch linux ARM installed. Everything works fine, except for the build of the JNI natural libraries. Here is the error message (and part of the log):
[INFO] --- maven-antrun-plugin:1.3:run (build-native-so) # pi4j-native ---
[INFO] Executing tasks
build-libpi4j.so:
[echo] Building native libpi4j shared library for ABI: hard-float
[sshexec] Connecting to 192.168.178.94:22
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Pi4J :: Parent POM ................................. SUCCESS [01:04 min]
[INFO] Pi4J :: JNI Native Library ......................... FAILURE [ 18.906 s]
[INFO] Pi4J :: Java Library (Core) ........................ SKIPPED
[INFO] Pi4J :: GPIO Extension ............................. SKIPPED
[INFO] Pi4J :: Device Abstractions ........................ SKIPPED
[INFO] Pi4J :: Java Examples .............................. SKIPPED
[INFO] Pi4J :: OSGi Service ............................... SKIPPED
[INFO] Pi4J :: Distribution ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:50 min
[INFO] Finished at: 2015-08-11T20:50:37+00:00
[INFO] Final Memory: 11M/29M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
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:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:131)
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:497)
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.taskdefs.Sequential.execute(Sequential.java:62)
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:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at net.sf.antcontrib.logic.IfTask.execute(Unknown Source)
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:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:497)
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:357)
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:118)
... 23 more
Caused by: /media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:188)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:497)
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:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
... 53 more
Caused by: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at com.jcraft.jsch.Session.receive_kexinit(Session.java:520)
at com.jcraft.jsch.Session.connect(Session.java:286)
at com.jcraft.jsch.Session.connect(Session.java:150)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:212)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:158)
... 66 more
I tried everything I could figure out, but I cannot make it work. Please help :)
EDIT:
After some further investigation, I am starting to have an idea about what these messages mean and how it works. This is the part of the build.xml that gives the error:
<!-- ensure the target directory is empty on the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="rm --recursive --force ${pi-dirBuildTemp}" />
And to be exact, it is the line starting with "verbose". I tried editing the command, removing parts of it... Nothing helps. I tried removing the whole block of code, leaving the others (that look really like that) and the error then is on the last line of the next block. Here is the whole /media/temp/pi4j-arch/pi4j-native/build.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project name="pi4j-native" default="build-libpi4j.so" basedir=".">
<target name="build-libpi4j.so">
<echo message="Building native libpi4j shared library for ABI: ${pi-abi}"/>
<!-- ensure the target directory is empty on the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="rm --recursive --force ${pi-dirBuildTemp}" />
<!-- ensure the target directory exists on the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="false"
verbose="true" command="mkdir --parents ${pi-dirBuildTemp}" />
<!-- copy all the necessary source files to the Raspberry Pi -->
<scp todir="${pi-user}:${pi-password}#${pi-host}:${pi-dirBuildTemp}"
port="${pi-port}" trust="true" verbose="true" failonerror="true">
<fileset dir="src/main/native" />
</scp>
<!-- download and compile the 'wiringPi.a' native static library on the Raspberry
Pi platform -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="cd ${pi-dirBuildTemp}; sudo chmod +x wiringpi-build.sh; ./wiringpi-build.sh" />
<!-- compile the 'lib4j.so' JNI native shared library on the Raspberry
Pi platform -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="cd ${pi-dirBuildTemp}; make clean; make all" />
<!-- copy the compiled 'lib4j.so' JNI native shared library back -->
<scp
file="${pi-user}:${pi-password}#${pi-host}:${pi-dirBuildTemp}/libpi4j.so"
todir="${project-build-directory}/${pi-abi}/" port="${pi-port}" trust="true"
verbose="true" failonerror="true">
</scp>
<!-- remove the temporary target directory from the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="rm --recursive --force ${pi-dirBuildTemp}" />
</target>
</project>
Maybe the problem is not in the code itself, but in the sshexec command. But I still haven't understood how exactly it works and what might be the problem. Tomorrow I will try to remove the variables and put the values there, just for the sake of the experiment.
EDIT2: I tested it... Still the same error at the same place...
If anyone has any ideas, please share.
EDIT3:
Thank you very much, prunge! Now I am a few steps ahead! I did both of the things you suggested, as with the first one it didn't work (But I forgot to restart SSH when trying, so maybe it would work).
Now I get another error, on another step... I get only one result when googled it, but I couldn't find the file they were talking about:
https://github.com/rm-hull/wiringPi/issues/2
And I am not sure if this is exactly the same issue.
Here is the error:
fatal: destination path 'wiringPi' already exists and is not an empty directory.
[UnInstall]
wiringPi Build script
=====================
The wiringPi I2C helper libraries will not be built.
WiringPi library
[UnInstall]
make: Nothing to be done for 'all'.
[Install]
GPIO Utility
[Link]
gpio.o: In function `main':
gpio.c:(.text.startup+0x194): undefined reference to `wiringPiSetupPiFaceForGpioProg'
gpio.c:(.text.startup+0x670): undefined reference to `gertboardSPISetup'
gpio.c:(.text.startup+0x684): undefined reference to `gertboardAnalogWrite'
gpio.c:(.text.startup+0x884): undefined reference to `gertboardSPISetup'
gpio.c:(.text.startup+0x894): undefined reference to `gertboardAnalogRead'
collect2: error: ld returned 1 exit status
Makefile:45: recipe for target 'gpio' failed
make: *** [gpio] Error 1
Make Failed...
Please check the messages and fix any problems. If you're still stuck,
then please email all the output and as many details as you can to
projects#drogon.net
[ant] Exiting /media/temp/pi4j-arch/pi4j-native/build.xml.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Pi4J :: Parent POM ................................. SUCCESS [01:07 min]
[INFO] Pi4J :: JNI Native Library ......................... FAILURE [04:05 min]
[INFO] Pi4J :: Java Library (Core) ........................ SKIPPED
[INFO] Pi4J :: GPIO Extension ............................. SKIPPED
[INFO] Pi4J :: Device Abstractions ........................ SKIPPED
[INFO] Pi4J :: Java Examples .............................. SKIPPED
[INFO] Pi4J :: OSGi Service ............................... SKIPPED
[INFO] Pi4J :: Distribution ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:41 min
[INFO] Finished at: 2015-08-13T17:01:08+00:00
[INFO] Final Memory: 12M/30M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
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:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:131)
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:497)
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.taskdefs.Sequential.execute(Sequential.java:62)
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:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at net.sf.antcontrib.logic.IfTask.execute(Unknown Source)
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:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:497)
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:357)
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:118)
... 23 more
Caused by: /media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.executeCommand(SSHExec.java:250)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:162)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
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:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
... 53 more
I really don't get how this works, I don't see anywhere the things written in the comments (in the build.xml file)... Here is the part of build.xml that is causing the error:
<!-- download and compile the 'wiringPi.a' native static library on the Raspberry
Pi platform -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="cd ${pi-dirBuildTemp}; sudo chmod +x wiringpi-build.sh; ./wiringpi-build.sh" />
I can't find the wiringpi-build.sh ...
Thanks and regards,
Krum
It's failing to talk to your Pi via SSH protocol.
If you haven't already, you might want to try installing the unlimited strength encryption policy files into your JDK/JRE you are running Maven from. This will allow more algorithms to be negotiated when connecting via SSH.
An alternative is to change SSHD configuration files on you Pi to allow some algorithms JSCH from your JDK/JRE supports. Details for doing this is in this answer.

nodejs plugin for dalek on Jenkins configuration issues questions

We are trying to run dalek on a Windows box with Jenkins.
We installed nodejs binary on the Windows box.
We installed the nodejs plugin on Jenkins.
When we run our job, we get this error:
[Test] $ C:\Windows\TEMP\hudson1848754731046994976.js
FATAL: command execution failed
java.io.IOException: Cannot run program "C:\Windows\TEMP\hudson1848754731046994976.js" (in directory "C:\jenkins\workspace\Test"): CreateProcess error=193, %1 is not a valid Win32 application
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:763)
at hudson.Launcher$ProcStarter.start(Launcher.java:353)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:988)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:955)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
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:72)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 17 more
What does this error mean ?
Is there a workaround to get us to run dalekjs ?
Thanks
First, make sure that you have configured the nodejs installation path in jenkins. If it still doesn't work try to create a symlink folder called bin in your node installation path pointing to itself.
This was how I did it. Open a terminal and execute:
mklink /j "C:\Program Files\nodejs\bin" "C:\Program Files\nodejs"
Have you defined nodejs installation path in Jenkins configuration?

Problems installing appdynamics

I have installed Appdynamics lite on my server and it worked fine when I used to run my tomcat instance with root user. But from the time I have created a new user "Tomcat" and start executing my apache tomcat with this user, I am not able to run appdynamics. I have copied the javaagent at this location with all rights(read,write,execute) to tomcat "/home/tomcat/profiler/AppServerLite". It throws an exception as follows :
Install Directory resolved to[/home/tomcat/profiler/AppServerLite]
java.lang.RuntimeException: Invalid Agent Installation Directory [/home/tomcat/profiler/AppServerLite]
at com.singularity.ee.agent.appagent.AgentEntryPoint.addThirdPartyURLs(AgentEntryPoint.java:190)
at com.singularity.ee.agent.appagent.AgentEntryPoint.premain(AgentEntryPoint.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:343)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:358)
Install Directory resolved to[/home/tomcat/profiler/AppServerLite]
java.lang.RuntimeException: Invalid Agent Installation Directory [/home/tomcat/profiler/AppServerLite]
at com.singularity.ee.agent.appagent.AgentEntryPoint.addThirdPartyURLs(AgentEntryPoint.java:190)
at com.singularity.ee.agent.appagent.AgentEntryPoint.premain(AgentEntryPoint.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:343)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:358)
18 Apr, 2013 1:57:03 PM org.apache.catalina.core.AprLifecycleListener init
You should copy all files to run the agent, not just javaagent.jar.
This is a thread about it. http://appsphere.appdynamics.com/t5/Lite-for-Java/Keep-getting-a-quot-Invalid-Agent-Installation-Directory-quot-on/td-p/1151
A great place to ask this question would be on the AppDynamics discussion forums so that AppDynamics support can answer you directly... http://appsphere.appdynamics.com/t5/Discussions/ct-p/Discussions
I'm guessing there is a permissions issue somewhere.

Resources