Jenkins windows ssh slave access denied - java

I want to build my projects on a Windows machine, so I created a slave there. First we tried the standard java application runner, but our build sets up its own environment and it always ended up deleting the existing Java installation, not giving any proper error messages, but failing. Then I switched to using Cygwin sshd and have Jenkins log in via ssh. This works for the connection (just as the standard method worked), but when I ran the build then it failed again to install the jdk. I ended up running the following command by hand:
C:\jenkins\tools\hudson.model.JDK\Latest\jdk.exe ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\jenkins\tools\hudson.model.JDK\Latest /L
This is the same as Jenkins would run, but without the /s (silent) option. Now when I run the build, I get the following error:
Building remotely on jenkins-slave-win64 (Johnny5) (windows) in workspace C:\jenkins\workspace\continuous.xill
java.io.IOException: remote file operation failed: C:\jenkins\tools\hudson.model.JDK\Latest at hudson.remoting.Channel#200354fa:jenkins-slave-win64 (Johnny5): java.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at hudson.FilePath.act(FilePath.java:987)
at hudson.FilePath.act(FilePath.java:969)
at hudson.FilePath.deleteRecursive(FilePath.java:1171)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:130)
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:360)
at hudson.model.Run.getEnvironment(Run.java:2234)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1036)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
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.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
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 hudson.Util.deleteFile(Util.java:247)
Of course I tried everything:
Run sshd as a different (Administrator) user
Checked every error mentioned here:
https://wiki.jenkins-ci.org/display/JENKINS/SSH+slaves+and+Cygwin
here
https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins
and here
http://www.noah.org/ssh/cygwin-sshd.html
And nothing works. Do you have a hint where to look?
UPDATE:
Meanwhile I managed to get a bit further in the build process by deactivating the option to "Automatically install jdk" in the Jenkins settings, git clone works and gradle starts up. However, now the JAVA_HOME environment variable somehow is not accessible to the slave (although we even tried setting it in .bashrc, just to be sure). So the build fails with this message":
FAILURE: Build failed with an exception.
* Where:
Script 'http://dl.bintray.com/content/shemnon/javafx-gradle/8.1.1/javafx.plugin' line: 60
* What went wrong:
A problem occurred evaluating script.
> Could not find JavaFX Packager Tools, please set one of [jfxrtDir in Gradle Properties, JFXRT_HOME in System Environment, JAVA_HOME in System Environment, java.home in JVM properties]

For your build error after "UPDATE" I think you have to add a JDK under Manage Jenkins > Configure System > JDK or in newer versions under Manage Jenkins > Global Tool Configuration > JDK

Related

How to launch locally built metals language server?

I am trying to set up emacs as scala editor. To that end i am trying to install metals for corresponding modes to work.
However, for some reason or another, metals either failed to install from emacs, or when installed with Coursier, were not responsive from emacs.
So, to explore all the options i decided to use metals source code (from Github? but i have run into the issue of being unable to properly utilize them.
What can i do to make metals available to emacs from the sources?
Currently, i have tried building them with
sbt publishLocal
and then trying to run the jar that was generated, with predictable result:
Exception in thread "main" java.lang.NoClassDefFoundError:
scala/collection/Seq at scala.meta.metals.Main.main(Main.scala)
Caused by: java.lang.ClassNotFoundException: scala.collection.Seq at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
Process metals stderr finished Exception in thread "main"
java.lang.NoClassDefFoundError: scala/collection/Seq at
scala.meta.metals.Main.main(Main.scala) Caused by:
java.lang.ClassNotFoundException: scala.collection.Seq at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
Process metals stderr finished
In my system i have installed with sbt, as suggested by the instructions on scala website.
How should i setup the system so that metals could be launched and used?
You shouldn't need to compile Metals from sources just to use it from Emacs. Check the official documentation: Emacs | Metals, especially the requirements and installation sections. It mentions
Next you have to install metals server. Emacs can do it for you when lsp-mode is enabled in a scala buffer or via lsp-install-server command. Also you can do it manually executing coursier install metals and configuring $PATH variable properly.
If you have problems with the installation, try asking on Scalameta Discord for help. There is a dedicated #emacs-users channel as well.
That said, if you still want to use a locally published Metals artifact for whatever other reason (e.g. contributing to the Metals code and testing changes locally), you should be able to do that. The contributing documentation describes how to work with the codebase and test your local Metals version.
In short, after you ran sbt publishLocal, you need to update the server version setting in your editor and run the Metals: Restart server command. It should pick up the locally published version.

Could not find the OffLine WLST class

I am trying to install Oracle ATS 12.5.0.3. on Windows 2008 R2 server.
At the end of the installation I get a warrning, that some actions failed. After looking into a log, I found:
Configuring data sources... D:\OracleATS\bin..\jdk\jre\bin\java.exe
-Djava.library.path=D:\OracleATS\bin..\install\lib -jar dbsetup.jar -setdefaultds Exception in thread "main" java.lang.RuntimeException: Could not find the OffLine WLST class at
weblogic.management.scripting.utils.WLSTUtil.getOfflineWLSTScriptPathInternal(WLSTUtil.java:128)
at
weblogic.management.scripting.utils.WLSTUtil.setupOfflineInternal(WLSTUtil.java:321)
at
weblogic.management.scripting.utils.WLSTUtil.setupOffline(WLSTUtil.java:298)
at
weblogic.management.scripting.utils.WLSTUtilWrapper.setupOffline(WLSTUtilWrapper.java:29)
at
weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:212)
at
weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:121)
at
oracle.oats.tools.databaseconfig.utils.DataSourceInitializer.(DataSourceInitializer.java:49)
at oracle.oats.tools.databaseconfig.ui.dbSetup.main(dbSetup.java:83)
Caused by: java.lang.ClassNotFoundException:
com.oracle.cie.domain.script.jython.WLST_offline at
java.net.URLClassLoader$1.run(URLClassLoader.java:366) at
java.net.URLClassLoader$1.run(URLClassLoader.java:355) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:354) at
java.lang.ClassLoader.loadClass(ClassLoader.java:425) at
java.lang.ClassLoader.loadClass(ClassLoader.java:358) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:274) at
weblogic.management.scripting.utils.WLSTUtil.getOfflineWLSTScriptPathInternal(WLSTUtil.java:121)
... 7 more ERROR: Unknown error (code: 1)
After some research, I tried to set CLASSPATH system variable to "." (it was not set at all previously). But it made no difference...
I am out of ideas how to fix this. Can somebody please help me?
Thanks in advance.
I faced the same issue today, installing OATS 13.1.0.1. Basically, it fails at the step of installing FMW (fusion middleware). It seems to fail because its installation step checks a lock file which was already created by the setup.bat.
Steps to correct this issue:
Uninstall clean. If uninstall/bin/uninstall.bat did not work, stop Oracle ATS services and delete them using regedit
Install FMW first. You can find fmw jar file from fmw folder in your unpacked OATS installation package directory (your fmw jar file name may vary). This step requires cmd run as administrator and the java should be from your jdk location
java -jar fmw_12.1.3.0.0_infrastructure.jar
To make this jive with the next step, you can choose C:\OracleATS\wls (or [the directory of your choice for OATS installation]\wls) for Oracle Home.
If you have failed the installation step before, it might have created the OLT schema in your local database. To avoid this issue, use your favorite SQL client to run these commands
drop user oats cascade; drop user olt cascade; drop user otm cascade;
Now run setup.bat to install OATS, use custom, unselect fusion middleware before continuing on installation
Once installation is finished, you can check it by visiting http://localhost:8088/admin/LoginSubmit.do and login using administrator:[password you set during installation]
i am not able to find the class,
com.oracle.cie.domain.script....
so i have done the following,
I have used all jars in wlserver\server\lib in classpath now the issue is resolved.
and added -Dweblogic.home= -Dbea.home=
now i have resolved the issue.

SonarQube/ANT Authentication required for 'svn+ssh://

Using fresh installed SonarQube 5.6, my ANT scanner complains svn: E170001: Authentication required for 'svn+ssh://my-server' while getting author (blame) data.
"C:\Program Files\Java\jdk1.8.0_51\bin\java" ... build.sonar.xml
[...shortened]
java.lang.IllegalStateException: Error when executing blame for file /path/to/foo.java
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
[...shortened]
Caused by: java.lang.IllegalStateException: Error when executing blame for file /path/to/foo.java
at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:102)
[...shortened]
Caused by: org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: Authentication required for 'svn+ssh://my-server'
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:47)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:41)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:203)
SonarQube-5.6 installation seems fine, I installed Java/JSON plugins as admin before first scan.
My code is obviously hosted at svn+ssh://my-server/path/to/root. There, svnadmin --version says Version 1.5.7 (r36142)
IP of my-server is in C:\Windows\System32\drivers\etc\hosts (I
contact the server through a tunnel and my-server has no DNS entry)
putty session named my-server connects successfully.
svn up works fine via TortoiseSVN v1.9.4 UI and command line and Intellij IDEA.
I have cached my SVN credentials. No pwd prompt when svn up
I use
win10 x64
JDK jdk1.8.0_51 (running ANT/build/sonarqube-ant-task-2.4.1.jar)
JRE version "1.8.0_91" (running SonarQube)
I had cleared my C:\Users\johndoe\AppData\Roaming\Subversion and rentered the pwd.
Any ideas how to get tmatesoft's SVNKit to use my cached authentication data? Thanks a lot!
Passing -Dsvnkit.ssh2.key=path/to/private/key pointing to an OpenSSH formatted private key file helped. I pass it as jvm arg to my ANT that runs the build.xml containing the <sonar> target.
By playing with SVNKit 1.8.12 standalone, logging enabled, I found the complaint about the private key file format.
Now, my scanner runs sucessfully for the first time.
Notably, not passing the correct property value now does not break the scan any more, just a small complaint about missing blame data. But I won't investgate that.

Unable to build project in Idea

There is a problem with building simple peace of code in Intellij Idea 14.
public class Main {
public static void main(String[] args) {
// write your code here
System.out.print("test");
} }
I'm stuck on following problem:
Error:Abnormal build process termination:
Build process started. Classpath: /C:/Program Files (x86)/JetBrains/IntelliJ IDEA Community Edition 14.1.5/lib/jps-launcher.jar;C:/Program Files/Java/jdk1.7.0_79/lib/tools.jar;/C:/Program Files (x86)/JetBrains/IntelliJ IDEA Community Edition 14.1.5/lib/optimizedFileManager.jar;C:/Program Files (x86)/JetBrains/IntelliJ IDEA Community Edition 14.1.5/lib/ecj-4.4.jar
Error connecting to 127.0.0.1:1081; reason: failed to create a child event loop
java.lang.IllegalStateException: failed to create a child event loop
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:81)
at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:50)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:72)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:58)
at org.jetbrains.jps.cmdline.BuildMain.main(BuildMain.java:97)
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.jetbrains.jps.cmdline.Launcher.main(Launcher.java:58)
Caused by: io.netty.channel.ChannelException: failed to open a new selector
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:127)
at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:119)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:97)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:31)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:77)
... 9 more
Caused by: java.io.IOException: Unable to establish loopback connection
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:125)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:69)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.ch.PipeImpl.<init>(PipeImpl.java:141)
Once I have compiled this code through command prompt, 'Main.class' file have been created.
Why this exception occurs in Idea?
There can be multiple causes of this. Can you try these solutions:
This might have to do with using Java 7 on windows 7 and the IP version prefs. A workaround might be to tell Java to prefer IPv4 via the JVM argument -Djava.net.preferIPv4Stack=true. You can set this config in intellij.
Or,I think it could be happening because of port limit. Can you add these 2 lines in your windows registry. "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\MaxUserPo‌​rt" (Type: DWORD; Value: 65500) "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\TcpTimedW‌​aitDelay" (Type: DWORD; Value: 30 )
After I have reinstalled Windows, it became to work.
One point that I have noticed after installing on a clean OS, is that firewall demanded me to allow open port after Idea have been started.
It seems that the issue appeared to be in an antivirus software, which restricted Idea to open port and start build a project. May be antivirus added some rules in firewall, so that I was unable to build it even after antivirus was turned off.

Deploying with JBoss 7.1.1.Final on Mac OSX

I've installed JBoss-as-7.1.1.Final on Mac OSX Mountain Lion and it seems to be on working order since I can access the management console on localhost 9990. Unfortunately, any decent tutorials for OSX I've come across end at exactly this point. I have no idea how to deploy a file.
I have Eclipse Kepler set up with JBoss tools installed, and that seems to have worked without a hitch. The Eclipse GUI has been changed appropriately.
I have a JBoss project in my workspace which is working on everyone else's (Windows) JBoss configuration, but when I try run as>run on server, here are the first few lines printed to the console:
Unable to set property fileName on class org.jboss.logmanager.handlers.FileHandler: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.logmanager.PropertyConfigurator.configureProperties(PropertyConfigurator.java:187)
at org.jboss.logmanager.PropertyConfigurator.configureHandler(PropertyConfigurator.java:312)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:128)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:86)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:246)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:231)
at java.util.logging.LogManager$2.run(LogManager.java:264)
at java.util.logging.LogManager$2.run(LogManager.java:262)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:262)
at java.util.logging.LogManager.getLogManager(LogManager.java:245)
at java.util.logging.Logger.<init>(Logger.java:225)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1295)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1293)
at java.util.logging.LogManager$1.run(LogManager.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(LogManager.java:153)
at org.jboss.modules.Main.main(Main.java:275)
Caused by: java.io.FileNotFoundException: /Users/dannyflynn/Desktop/jboss-as-7.1.1.Final/standalone/log/boot.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:152)
at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:183)
... 22 more
I've also tried running on J2EE preview server, which is normally met with: "Server JBoss 7.1 Runtime Server failed to start."
The screen at localhost 8080 remains unchanged in all cases. However, this was not happening yesterday. At least yesterday it changed to a blank screen indicating that it could not access the server whenever I tried to run the program. I'm not sure what has changed since.
Tried the solution offered here of using chmod 755 on standalone/boot.log. It produces the following output to the terminal:
chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ...
chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...
The console output seems to be more or less the same, still beginning with a complaint about being unable to set property filename, but now there's a pop-up window stating "Server JBoss 7.1 Runtime Server failed to start."
It seems pretty clear it's a permissions issue with the boot.log file. Check that your user as sufficient permissions to write to the directory and/or file.
I didn't managed to fix this using the permissions approach directly. This may have more to do with my lack of understanding of it than anything else. However, what did work for me was the following.
Re-install JBoss
Create another management domain user ( I didn't do anything different here as far as I know, though going by the SO consensus, this is probably where the problem lay)
Place the mySQL connector back in JBOSSHOME/standalone/deployments and recreate the dependency for it through the JBOSS management console.
Run Mvn clean install on the project
Maven>Update project through Eclipse.
Export project as war file to JBOSSHOME/standalone/deployments
Run standalone.sh
Everything is now running smoothly.

Categories