How Do You Get Jenkins Running on Linux to Work With Windows Servers?

Problem scenario
You want your central Jenkins 1.651.1 server running on Linux to push down builds (or run jobs) on Windows servers.  When you try to connect Jenkins master to a slave server, you get an error message like this:

"ERROR: Access is denied. See http://wiki.jenkins-ci.org/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM for more information about how to resolve this. org.jinterop.dcom.common.JIException: Message not found for errorCode: 0x00000005 at org.jinterop.dcom.core.JIComServer.init(JIComServer.java:"

You know the credentials and IP address are correct.  You want the Jenkins server (on Linux) to communicate with other Windows servers.  How do you do this without a permissions error like the one above?

Possible Solution #1
Prerequisites

  • You must use Jenkins version 1.x.  This solution will not work for Jenkins version 2.32.1 or higher.  It may not work for Jenkins 2.x at all. If you want to install Jenkins 1.651.1 see this posting
  • You must have a Windows server to be "managed node" of the Jenkins server running on Linux.  These directions below are of no use if you are not using a Windows server (to configure as a worker node of Jenkins).  If you want to deploy a Windows server in AWS, see this posting.

Procedures
1.  Make sure that JRE is installed on the Windows server.  You can download a standalone (offline) installer here:  https://java.com/en/download/manual.jsp

2.  On the Windows server, open a web browser and go to this URL (constructed with the directions in the sentence beneath it):

http://3.3.3.3:8080/computer/4.4.4.4/slave-agent.jnlp

Replace the 3.3.3.3 with the IP address of the Jenkins master server.  Replace the 4.4.4.4 with the IP address of the Windows server you want builds to run on (aka the Windows slave). 

Click "Run" to install the Java component (the Jenkins Remoting Agent) in the pop up.

If the above does not work, Open PowerShell as administrator and run this command.  The command will look like this (read the content beneath it to customize it properly):

javaws http://3.3.3.3:8080/hudson/computer/4.4.4.4/slave-agent.jnlp

Replace the 3.3.3.3 with the IP address of the Jenkins master server.  Replace the 4.4.4.4 with the IP address of the Windows server you want builds to run on (aka the Windows slave).  If the above does not work, you may need to put a copy of the jenkins-cli.jar file on the WIndows server.  Then you can execute java commands with the jenkins-cli.jar file if you initially pass username and password if your Jenkins instance requires it.

Opening PowerShell without being an administrator, or any sort of CMD prompt, and running the javaws command above will not allow Jenkins builds to work as robustly as you would normally want them to run.  Jenkins may appear to register successful build runs.  The console output (in Jenkins) may have an "Access Denied" message which would refer to the inability of Jenkins to write to certain folders on the Windows server.  

Opening PowerShell without being an administrator, or any sort of CMD prompt, and running the javaws command above can create problems with Jenkins runs that are difficult to troubleshoot.  Despite the improved security, the javaws command should only be run with these methods (e.g., a cmd prompt or PowerShell opened not as administrator) if you are certain you know what you are doing.

Related tip:  JNLP is powerful for managing servers in a heterogeneous environment from a Linux Jenkins instance.  Ensure your Jenkins server does not allow anonymous access.  If from a server you can open a web browser and type in the Jenkins URL and view Jenkins without being challenged for credentials, your Jenkins instance is not secure.

Possible Solution #2
There are no prerequisites. If you want to install Cygwin on the Linux server, the Windows server will act like a Linux server. You can use this posting to install Cygwin.

Leave a comment

Your email address will not be published.