we have jenkins slaves started by ec2 plugin. We keep on seeing java version being set to 265 when a new node is started
but slaves don't even have java-1.8.0-openjdk-1.8.0.265.b01-1.amzn2.0.1.z86_64 in /usr/lib/jvm/
ls /usr/lib/jvm/
java
java-1.8.0
java-1.8.0-openjdk
java-1.8.0-openjdk-1.8.0.312.b07-1.amzn2.0.2.x86_64
java-openjdk
jre
jre-1.8.0
jre-1.8.0-openjdk
jre-1.8.0-openjdk-1.8.0.312.b07-1.amzn2.0.2.x86_64
jre-openjdk
I checked all the non-jre's directories, they are all 312 versions, java -version shows 312, master has java 1.8.66. And I am lost how this 265 version is set when a new node is added.
there is no JVM version selected on master in any settings as far as I could tell.
help is appreciated. thanks in advance.
You can try following steps:
Check the agent Log to determine the location of remoting directory and remoting.jar in the slave server.
Disconnect agent
Delete both remoting directory and remoting.jar
Launch the agent.
The agent refer to the data present inside the jarCache directory inside remoting.
Related
I have maven installed in my windows machine (here is the path: C:\Program Files\apache-maven-3.8.4) and Jenkins running in a docker container.
When I try to add maven path in Jenkins >> Global Tools Configuration, It is giving me following error
C:\Program Files\apache-maven-3.8.4\ is not a directory on the Jenkins controller (but perhaps it exists on some agents)
Is it possible to refer locally installed maven or JDK path in Jenkins which is running in a docker container? If yes, can you provide a sample working path
Thanks,
Bala
I'm getting this error when I try a Jenkins build on a maven project:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
The java and maven plugin are installed automatically, after several research, I couldn't find a solution!
Does anyone have ever face this issue?
Go To Jenkins -> Manage Jenkins -> Global Tool Configuration -> JDK. Provide path to the JDK under JAVA_HOME field.
First make sure the your Job in Jenkins doesn't use the "default Jdk" by going to the job:
Press on Configure - > and roll to the JDK section - and make sure you have JDK configure instead of Default.
if you don't have it - go back to Jenkins - > Manage Jenkins -> Configure System - > Jdk and map your Jdk Root for Jenkins.
when you finish that - go back and choose your map JDK - and everything will work.
Go To Jenkins -> Manage Jenkins -> Global Tool Configuration.
Now click on "JDK installations.." under JDK
Uncheck Install automatically
Provide path to the JDK under JAVA_HOME field.
Refer:-
May be this issue is already resolved by now. But I had the same issue recently and I have the following settings in my Jenkins. This happened in my Windows 10 Jenkins installation.
Installed JDK at C:\Java\Jdk8 and made JAVA_HOME point to this location. Also make sure that PATH env variable has %JAVA_HOME%\bin.
Installed JRE (which comes bundled with Oracle JDK installation) at C:\Program Files\Java\JRE.
Jenkins -> Manage Jenkins -> Configure System
Jenkins -> Manage Jenkins -> Global Tool Configuration
# javac -version
javac 1.8.0_201
# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
# mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
Maven home: C:\apache-maven-3.6.0\bin\..
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Java\jdk8\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
I believe the change that fixed the problem was the addition of env variables under Manage Jenkins -> Configure System.
Enter http://localhost:8080/configure. Then go Jenkins Location.
Jenkins Configuration:
Environment variable configuration:
You might not have set JAVA_HOME in Jenkin installed server. Set JAVA_HOME and restart your Jenkin server.
According to your error message you either do not have a JDK installed or you need to configure Jenkins's CLASSPATH to point to your JDK installation.
Just give the JDK path in Jenkins Global Tool configurations, i.e the path where we have kept the jdk file in the di
IF you don't want to add anythig in Global tools Configuration, add new environment variable java.home in the Jenkins slave configuration as maven detects java.home and not JAVA_HOME.
java.home ---> C:\Java\jdk1.8.0_181\jre
I have installed jdk 8 and set path in system variable.
I am getting below error and might be because of that not getting user password to login to local host.
my error are below:
Error injecting constructor, java.lang.NoClassDefFoundError: hudson/tools/JDK
Installer$FileSystem
at hudson.os.windows.ManagedWindowsServiceLauncher$DescriptorImpl.<init>(Manag
edWindowsServiceLauncher.java:540)
and
Error injecting constructor, java.lang.NoClassDefFoundError: hudson/tools/JDK
Installer$FileSystem
at hudson.plugins.sshslaves.SSHLauncher$DescriptorImpl.<init>(SSHLauncher.java
:1550)
please help to resolve.
To run the Jenkins WAR from the commandline you would execute
java -jar jenkins.war
This will cause the war file to explode itself to a war directory and as Jenkins includes a JETTY web server it will "self host" at localhost:8080. It will take a couple of minutes to do this. Jenkins will present the new instance wizard screens for you to go through which will install recommended plugins to get going.
Initially you won't have to log into Jenkins as "Anyone can do anything".
The next steps should be:
If you are running on windows, navigate to Manage Jenkins > Install as Windows Service and specify a Jenkins Home directory (Suggest E:\Jenkins or on a secondary partition or C:\Jenkins). The user doing this will need to be an administrator on the machine for this to work.
Install plugins at Manage Jenkins > Manage Plugins
Set up Security at Manage Jenkins > Configure Security
I'm seeing the below error when I try to install plugins for Jenkins.
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\tech>cd C:\Program Files (x86)\Jenkins
C:\Program Files (x86)\Jenkins>java -jar jenkins-cli.jar -s http://localhost:8081/ install-plugin ant.hpi -deploy -restart
Exception in thread "main" java.io.IOException: No X-Jenkins-CLI2-Port among [null, X-Required-Permission, X-Jenkins,
X-You-Are-In-Group, X-Hudson, Content-Length, Expires, X-You-Are-Authenticated-As, X-Permission-Implied-By, Set-Cookie,
Server, X-Content-Type-Options, Date, X-Jenkins-Session, Content-Type]
at hudson.cli.CLI.getCliTcpPort(CLI.java:290)
at hudson.cli.CLI.<init>(CLI.java:133)
at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
at hudson.cli.CLI._main(CLI.java:474)
at hudson.cli.CLI.main(CLI.java:389)
Suppressed: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8081/cli
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:78)
at hudson.cli.CLI.connectViaHttp(CLI.java:163)
at hudson.cli.CLI.<init>(CLI.java:137)
... 3 more
I have installed Jenkins as a Windows Installer
Windows service started
Then I copied jenkins-cli.jar to the jenkins folder
ant.hpi file is located at jenkins folder itself (I also copied to different drive and gave the absolute path during installation)
Enter the command to install plugin which resulted in error as shown above
From the troubleshooting section of the CLI documentation:
Go to Manage Jenkins > Configure Global Security and choose "Fixed" or "Random" under TCP port for JNLP agents.
The CLI is disabled by default; you need to enable this TCP port in Jenkins so that CLI clients may connect.
Also, assuming that your Jenkins master has access to the internet, you can just specify the ant plugin ID on the command line to install the Ant Plugin (and its dependencies!) directly from the Jenkins Update Centre, rather than having to download and specify each of the required .hpi files.
After some trial and errors, got it working by this aliasing statement for jenkins-cli
alias jenkins-cli='java -jar /var/lib/jenkins/jenkins-cli.jar -auth admin:admin'
After this aliasing, you can use the commands like:
jenkins-cli help
jenkins-cli who-am-i
and many other commands (listed by help)
In my case here, I had added SSH key for 'admin' user of Jenkins and I had changed its password to 'admin'
I want to increase the available heap space for Jenkins. But as it is installed as a service I don´t know how to do it.
If you used Aptitude (apt-get) to install Jenkins on Ubuntu 12.04, uncomment the JAVA_ARGS line in the top few lines of /etc/default/jenkins:
# arguments to pass to java
#JAVA_ARGS="-Xmx256m" # <--default value
JAVA_ARGS="-Xmx2048m"
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address
In your Jenkins installation directory there is a jenkins.xml, where you can set various options.
Add the parameter -Xmx with the size you want to the arguments-tag (or increase the size if its already there).
You need to modify the jenkins.xml file. Specifically you need to change
<arguments>-Xrs -Xmx256m
-Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle
-jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
to
<arguments>-Xrs -Xmx2048m -XX:MaxPermSize=512m
-Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle
-jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
You can also verify the Java options that Jenkins is using by installing the Jenkins monitor plugin via Manage Jenkins / Manage Plugins and then navigating to Managing Jenkins / Monitoring of Hudson / Jenkins master to use monitoring to determine how much memory is available to Jenkins.
If you are getting an out of memory error when Jenkins calls Maven, it may be necessary to set MAVEN_OPTS via Manage Jenkins / Configure System e.g. if you are running on a version of Java prior to JDK 1.8 (the values are suggestions):
-Xmx2048m -XX:MaxPermSize=512m
If you are using JDK 1.8:
-Xmx2048m
I've added to /etc/sysconfig/jenkins (CentOS):
# Options to pass to java when running Jenkins.
#
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Xmx1024m -XX:MaxPermSize=512m"
For ubuntu the same config should be located in /etc/default
From the Jenkins wiki:
The JVM launch parameters of these
Windows services are controlled by an
XML file jenkins.xml and
jenkins-slave.xml respectively. These
files can be found in $JENKINS_HOME
and in the slave root directory
respectively, after you've install
them as Windows services.
The file format should be
self-explanatory. Tweak the arguments
for example to give JVM a bigger
memory.
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Windows+service