Starting https Jenkins server on 127.0.0.1 - jenkins

Embarrassingly enough I am one page into Jenkins Continuous Integration Cookbook and I'm already stuck on this command:
Java -jar jenkins.war --httpsPort=8443 --httpPort=-1
On my Mac, this throws up with:
Running from: /home/NAThompson/jenkins/war/target/jenkins.war
webroot: $user.home/.jenkins
Feb 22, 2015 7:37:24 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Using one-time self-signed certificate
Feb 22, 2015 7:37:24 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Feb 22, 2015 7:37:24 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start a listener: winstone.HttpsConnectorFactory
at winstone.Launcher.spawnListener(Launcher.java:209)
at winstone.Launcher.<init>(Launcher.java:149)
at winstone.Launcher.main(Launcher.java:354)
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:483)
at Main._main(Main.java:293)
at Main.main(Main.java:98)
Caused by: java.lang.NoClassDefFoundError: sun/security/x509/CertAndKeyGen
at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:100)
at winstone.Launcher.spawnListener(Launcher.java:207)
... 8 more
Caused by: java.lang.ClassNotFoundException: sun.security.x509.CertAndKeyGen
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more
What can I do to get around this? As extraneous info, the server starts just fine using http.

This looks like a known issue with trying to use HTTPS directly from the jenkins.war. Some have suggested running Jenkins from within Tomcat and letting Tomcat handle SSL (I've not tried this personally yet, however).

I fixed this issue for myself by setting Jenkins to run using Java 7. I am running it as a service so I did this by editing the jenkins-runner.sh file. I added the following line:
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home"
and then modified the last two lines to:
echo $JAVA_HOME/bin/java $javaArgs -jar "$war" $args
exec $JAVA_HOME/bin/java $javaArgs -jar "$war" $args
I also made sure to set the httpsKeyStore and httpsKeyStorePassword properties after creating a selfsigned certificate (instructions here under Using SSL: Installing and Configuring Jenkins)

First, I would not recommend running Jenkins within a Mac environment unless of course you are developing for the Mac/IOS. In that case, you have an error with Java installation and/or configs. The real error is ClassNotFoundException: sun.security.x509.CertAndKeyGen. You should verify your version of Java with the requirements of the version of Jenkins you are using. I read a few blog articles that hinted that it is likely a discrepancy with the Java version you (Mac OS) is running.
Secondly, it is highly unlikely that you will ever use Mac for your CI needs. You should really look into running local virtual machines that will mimic your CI environments. You can get started easily with open source tools like VirtualBox and Vagrant.

Related

JRebel remoting crashing WebSphere on Docker using Eclipse

I have configured JRebel remoting mode in an Eclipse maven project on a Windows Machine, and running WebSphere in a Linux docker container.
In JVM args, it's setting
-agentpath:/opt/jrebel/lib/libjrebel64.dll -Drebel.remoting_plugin=true
When I change source code, jrebel start updating code, and I got the error:
2018-02-27 23:32:14.066 ERROR [rebel-CancellableExecutorService-1] c.z.jrebel.remoting.Transaction - [OUT] [tr_36] [Project <maven-module-name>, server websphere] Synchronization failed! Read timed out
com.zeroturnaround.jrebel.remoting.RemotingException: Read timed out
at com.zeroturnaround.jrebel.remoting.net.RemotingClient.tryMakePostRequest(JRebelRemoting:189)
at com.zeroturnaround.jrebel.remoting.net.RemotingClient.sendTransactionCommand(JRebelRemoting:147)
at com.zeroturnaround.jrebel.remoting.net.RemotingClient.commitTransaction(JRebelRemoting:101)
at com.zeroturnaround.jrebel.remoting.Transaction.commit(JRebelRemoting:487)
at com.zeroturnaround.jrebel.remoting.Transaction.synchronize(JRebelRemoting:231)
at com.zeroturnaround.jrebel.remoting.RemoteServer$1.run(JRebelRemoting:56)
at org.zeroturnaround.common.util.ExecutorUtil$RunnableWrapper.run(ExecutorUtil.java:153)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketTimeoutException: Read timed out
After that, the web application and WebSphere crashed.
The error message indicates that the connection failed between the IDE and the WebSphere application server running inside your Linux Docker container.
Firstly, if you are starting your WebSphere server on a Linux machine, you should use the JRebel's agent library compiled for Linux. That is, you should use libjrebel64.so in the -agentpath argument's path value instead of libjrebel64.dll. Using the .dll in Linux environment should crash the server on startup. Currently, my hypothesis is that the server does not respond since it does not even start up correctly.
Additionally, please make sure that the server is reachable via the address you entered in the remote server configuration on the IDE side.
If the same issue persists after the previous suggestions, please do reproduce this issue and send us the jrebel.log and jrebel-eclipse.log files from ~/.jrebel/ directory to support#zeroturnaround.com.

Unable to create a windows salve node for jenkins

I have setup a master on Ubuntu machine and want to create a salve on Windows 10. While launching the agent I am facing following issue. Can someone please help.
just before slave javed_pc gets launched ...
executing pre-launch scripts ...
[2017-04-21 10:26:54] [windows-slaves] Connecting to 172.26.152.23
Checking if Java exists
java -version returned 1.8.0.
[2017-04-21 10:26:56] [windows-slaves] Copying jenkins-slave.xml
[2017-04-21 10:26:56] [windows-slaves] Copying slave.jar
[2017-04-21 10:26:56] [windows-slaves] Starting the service
ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins
org.jinterop.dcom.common.JIException: Service Logon Failure
at org.jvnet.hudson.wmi.Win32Service$Implementation.start(Win32Service.java:149)
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor206.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.kohsuke.jinterop.JInteropInvocationHandler.invoke(JInteropInvocationHandler.java:140)
Caused: java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy64.start(Unknown Source)
at hudson.os.windows.ManagedWindowsServiceLauncher.launch(ManagedWindowsServiceLauncher.java:342)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:262)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Using the JENKINS Windows Slaves Plugin, check if one of the reason listed in "Windows slaves fail to start via DCOM" would apply in your case.
It lists a wide variety of reasons, from the Windows account used, to network, registry, security reasons.
Make sure you don't have a proxy issue, where Jenkins would try and use said proxy to access a machine (Windows here) on your LAN: the environment variable no_proxy should be used to exclude your local domain.
The OP Javed Ahmed reports having solve it with:
In 'Configure Global security' settings, when you check 'Enable Security' option, then it allows you to connect via java web start.
Otherwise It was not showing the the option to connect through java web start and connecting via windows service is a pain.

Connection dropped for Jenkins slave on Kubernetes

Performed update to Kubernetes 1.5.2 on Google Container Engine.
Then started getting the following errors:
Failed to count the # of live instances on Kubernetes
To resolve this I then upgraded Jenkins (to 2.32.2) and the Kubernetes plugin (to 0.10) to the latest versions.
Afterwards, then I started getting the following errors:
Feb 08, 2017 9:51:52 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
WARNING: Connection #5 failed
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:197)
at java.io.DataInputStream.readFully(DataInputStream.java:169)
at hudson.TcpSlaveAgentListener$ConnectionHandler.run(TcpSlaveAgentListener.java:213)
Feb 08, 2017 9:51:57 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud$ProvisioningCallback call
SEVERE: Error in provisioning; slave=KubernetesSlave name: default-6126d6e4fb5, template=org.csanchez.jenkins.plugins.kubernetes.PodTemplate#47404ab7
java.lang.IllegalStateException: Containers are terminated with exit codes: {jnlp=255}
at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud$ProvisioningCallback.call(KubernetesCloud.java:600)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud$ProvisioningCallback.call(KubernetesCloud.java:532)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
The last error was resolved by changing the slave container name to jnlp instead of default (see image). The google documentation shows the name is supposed to be default but it seems with these updates this is not the right approach to get this system working.
It looks like the updated kubernetes-plugin creates two containers (a container with your specified image and another with the default jnlp image). If your image's name isn't jnlp then the plugin will run both containers in the slave pod... this seems to be causing the connection issue.
As #Alex mentioned the problem is the name of the container. It has to be jnlp otherwise you get the below error.
java.lang.IllegalStateException: Pod has terminated containers: jenkins/jnlp-42t0n (prod-slave)
Initially I named the container prod-slave that caused it to create two containers in the slave pod. The additional container was named jnlp. When I renamed the container name in container template to jnlp everything worked perfectly with only one container in the slave pod.
Although it seems weird to me that naming of a container could affect the behavior of the slave!
I also faced same issue as #Alex and #Shinto
I used container name as slave-agent with docker image jenkins/jnlp-slave:latest and It started creating two containers with error
Error in provisioning; agent=KubernetesSlave name: kube-xgmd5, template=PodTemplate{id='9af2eabc-971f-42d4-8710-549942d76cbe', name='kube', label='kubepod', podRetention='On Failure', containers=[ContainerTemplate{name='slave-agent', image='jenkins/jnlp-slave:latest', workingDir='/home/jenkins/agent', command='', args='', resourceRequestCpu='', resourceRequestMemory='', resourceRequestEphemeralStorage='', resourceLimitCpu='', resourceLimitMemory='', resourceLimitEphemeralStorage='', envVars=[KeyValueEnvVar [getValue()=http://192.168.29.123:8080/jenkins/, getKey()=jenkins]], livenessProbe=ContainerLivenessProbe{execArgs='', timeoutSeconds=0, initialDelaySeconds=0, failureThreshold=0, periodSeconds=0, successThreshold=0}}]}
**java.lang.IllegalStateException: Pod has terminated containers: default/kube-xgmd5 (slave-agent)**
When updated container name to jnlp. It worked as expected.

Jenkins agent keeps disconnecting / reconnecting repeatedly

I have a jenkins master server. I just created a new jenkins agent and launching it via Java Web Start in a ubuntu host. The agent connects successfully, but after some time it says "Terminated", then again after some time it says "Connected". And it keeps repeating like this throughout.
I am not even trying to run a build/job yet
Interestingly enough, this ubuntu agent and this jnlp and this java web start has been working fine for the last several weeks - even until a few hours ago. Now suddenly it's starting to disconnected and reconnect repeatedly like this.
JNLP agent connected from /116.68.205.58
<===[JENKINS REMOTING CAPACITY]===>Slave.jar version: 3.2
This is a Unix agent
ERROR: Connection terminated
java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:73)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2353)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2822)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:301)
at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:59)
ERROR: Failed to install restarter
hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.Request.abort(Request.java:307)
at hudson.remoting.Channel.terminate(Channel.java:888)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:92)
at ......remote call to Channel to /116.68.205.58(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1537)
at hudson.remoting.Request.call(Request.java:172)
at hudson.remoting.Channel.call(Channel.java:821)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller.install(JnlpSlaveRestarterInstaller.java:52)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller.access$000(JnlpSlaveRestarterInstaller.java:33)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$1.call(JnlpSlaveRestarterInstaller.java:39)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$1.call(JnlpSlaveRestarterInstaller.java:36)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:73)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2353)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2822)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:301)
at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:59)
JNLP agent connected from /116.68.205.58
<===[JENKINS REMOTING CAPACITY]===>Slave.jar version: 3.2
This is a Unix agent
Check the jenkins slave log for possible problems. Also, how is the Availability setting under the Jenkins node configuration page?
Jenkins >> Manage Jenkins >> Manage Nodes >> your node >> Configure
I recently had a Windows slave with the same symptom and change the Availability from
"Take this agent online when in demand, and offline when idle"
to
"Keep this agent online as much as possible"
and it solved my problem, but you might have a different problem from the one I had. So I suggest first viewing the slave logs. If you can, post the log snippet here for further analysis.

jodconverter java.lang.ClassNotFoundException

I have installed openoffice and jodconverter on ubuntu 12.04 (64) in order to convert .xls into pdf.
I have the same installation on 10.04 (64) working great, however having just built a new machine with freshly installed 12.04, it simply refuses to run.
It is a headless machine and openoffice is called with:
soffice --headless --nologo --nofirststartwizard "--accept=socket,host=127.0.0.1,port=8100;urp"
I have confirmed that it is listening on 8100:
netstat -an | grep 8100
tcp 0 0 127.0.0.1:8100 0.0.0.0:* LISTEN
however runnind jodconverter (to convert pcash.xls to pcash.pdf) always results in this ClassNotFound error:
jodconverter pcash.xls pcash.pdf
Oct 4, 2012 3:07:52 PM com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection connect
INFO: connected
Oct 4, 2012 3:07:52 PM com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection disposing
INFO: disconnected
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/task/ErrorCodeIOException
at com.artofsolving.jodconverter.cli.ConvertDocument.main(ConvertDocument.java:129)
Caused by: java.lang.ClassNotFoundException: com.sun.star.task.ErrorCodeIOException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
I have clicked pretty much every link in google, I have installed open-office with apt-get as well as by downloading the latest and installing from .deb and it makes no difference.
This works flawlessley on 10.04 and yet I have spent the last 6 hours getting nowhere !!
Are you sure you are using openoffice and not libreoffice which is default in ubuntu?
I have experienced some problems with newer versions of LibreOffice.
Also there might be issues with supporting newer versions of OpenOffice since JODConverter is no longer maintained. Try the same OpenOffice version you had with 10.04

Resources