Search code examples
eclipseantjenkinscontinuous-integrationtemenos-quantum

How to create build of a Kony project with Jenkins - Continuos Integration


I'm trying during three days create an auto build of a Kony project. I'm using a Mac OSX.

When I did

$ su jenkins
$ git clone git@gitserver:/git/myproject.git
$ cd myproject
$ ant main

In this way the project is built successfully!!

But, if I try to configure Jenkins to do the same work, its doesn't work!! The problem occurs during ant main.

This is the Jenkins log:

+ ant main
ant main Buildfile: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.xml

main:
     [echo] Looking for JAR antcontrib.jar at : /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/ant-contrib-0.6.jar
     [echo] Started script...
     [echo] Global properties file LOCATION: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/global.properties
     [echo] Build properties file LOCATION: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.properties
     [echo] WORKSPACE LOCATION: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/
     [exec] _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
     [exec] [09-12-2014 10:19:20]Executing build file: /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp//masterbuild.xml
     [exec] 
     [exec] commoninit:
     [exec] cmdl.getCommandline(): [Ljava.lang.String;@4c309d4d
     [exec] 
     [exec] ***********/bin/sh
     [exec] 
     [exec] ***********/c
     [exec] 
     [exec] ***********chmod 777 /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp//preview/node_mac/bin/node
     [exec] 
     [exec] ***********/bin/sh
     [exec] 
     [exec] ***********/c
     [exec] 
     [exec] ***********-c
     [exec] 
     [exec] midlog4jtarget:
     [exec]      [echo] Copying thinclient jar files to jetty lib
     [exec]      [copy] Copying 6 files to /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp/jettydeploy/lib
     [exec]      [echo] Copying thinclient jar files to jetty lib
     [exec]      [copy] Copying 1 file to /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp/jettydeploy/lib
     [exec]      [copy] Copying 1 file to /Users/Shared/Jenkins/Home/jobs/myproject/workspace/middleware/middleware-bootconfig/tc
     [exec] 2014-09-12 10:19:21.644::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
     [exec] ***WARNING: Display must be created on main thread due to Cocoa restrictions.
     [exec] [JETTY Server] HTTP  - started and listening on [8888]
     [exec] [JETTY Server] HTTPS - started and listening on [8443]
     [exec] log4j:WARN No appenders could be found for logger (Licensing).
     [exec] log4j:WARN Please initialize the log4j system properly.
     [exec] 
     [exec] version= 1.5
     [exec] 
     [exec] name= Android 1.5
     [exec] 
     [exec] version= 1.6
     [exec] 
     [exec] name= Android 1.6
     [exec] 
     [exec] version= 2.1
     [exec] 
     [exec] name= Android 2.1
     [exec] 
     [exec] version= 2.2
     [exec] 
     [exec] name= Android 2.2
     [exec] 
     [exec] version= 2.3.3
     [exec] 
     [exec] name= Android 2.3.3
     [exec] 
     [exec] version= 3.0
     [exec] 
     [exec] name= Android 3.0
     [exec] 
     [exec] version= 3.1
     [exec] 
     [exec] name= Android 3.1
     [exec] 
     [exec] version= 3.2
     [exec] 
     [exec] name= Android 3.2
     [exec] 
     [exec] version= 4.0
     [exec] 
     [exec] name= Android 4.0
     [exec] 
     [exec] version= 4.0.3
     [exec] 
     [exec] name= Android 4.0.3
     [exec] 
     [exec] version= 4.1.2
     [exec] 
     [exec] name= Android 4.1.2
     [exec] 
     [exec] version= 4.2.2
     [exec] 
     [exec] name= Android 4.2.2
     [exec] 
     [exec] version= 4.3
     [exec] 
     [exec] name= Android 4.3
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Android 4.4.2
     [exec] 
     [exec] version= 4.4W
     [exec] 
     [exec] name= Android 4.4W
     [exec] 
     [exec] version= 1.5
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 1.6
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 2.1
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 2.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 2.3.3
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.0
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.1
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.2
     [exec] 
     [exec] name= Google TV Addon
     [exec] 
     [exec] version= 4.0
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.0.3
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.1.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.2.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.3
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Glass Development Kit Preview
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Google APIs (x86 System Image)
     [exec] 
     [exec] Version=7
     [exec] 
     [exec] Version=8
     [exec] 
     [exec] Version=10
     [exec] 
     [exec] Version=11
     [exec] 
     [exec] Version=12
     [exec] 
     [exec] Version=13
     [exec] 
     [exec] Version=14
     [exec] 
     [exec] Version=15
     [exec] 
     [exec] Version=16
     [exec] 
     [exec] Version=17
     [exec] 
     [exec] Version=18
     [exec] 
     [exec] Version=19
     [exec] Time taken for populating SDK List: 3832
     [exec] Argument: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.properties
     [exec] Workspace Loc: /Users/Shared/Jenkins/Home/jobs/myproject/workspace
     [exec] 
     [exec] [Jetty Server] Shutdown is successful
     [exec] An error has occurred. See the log file
     [exec] /Users/Shared/Jenkins/Home/jobs/myproject/workspace/.metadata/.log. BUILD FAILED /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.xml:123: exec returned: 13

Total time: 28 seconds Build step 'Execute shell' marked build as failure Finished: FAILURE

Only remember, when I did manually the same process this problem do not happen. File: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/.metadata/.log

!SESSION 2014-09-12 10:34:09.679 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.8.0
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -application com.pat.tool.keditor.konyapplication
Command-line arguments:  -data /Users/Shared/Jenkins/Home/jobs/myproject/workspace/ -application com.pat.tool.keditor.konyapplication

This is a continuation of log file /Users/Shared/Jenkins/Home/jobs/myproject/workspace/.metadata/.bak_0.log
Created Time: 2014-09-12 10:34:23.895

!ENTRY org.eclipse.osgi 4 0 2014-09-12 10:34:23.895
!MESSAGE Application error
!STACK 1
java.lang.NoClassDefFoundError: org/eclipse/ui/actions/SelectionListenerAction
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:632)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:607)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.pat.tool.keditor.actions.ResourceActionHelper.runTasks(ResourceActionHelper.java:770)
    at com.pat.tool.keditor.actions.ResourceActionHelper.runTasks(ResourceActionHelper.java:516)
    at com.pat.tool.keditor.commandline.CommandLineApplication.start(CommandLineApplication.java:175)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
    at org.eclipse.core.launcher.Main.main(Main.java:34)
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.ui.ide (210).
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:122)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:469)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
    at org.eclipse.osgi.internal.loader.MultiSourcePackage.loadClass(MultiSourcePackage.java:31)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 32 more
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.start() of bundle org.eclipse.ui.ide.
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
    ... 42 more
Caused by: java.lang.NullPointerException
    at org.eclipse.swt.graphics.Device.getPrimaryScreen(Device.java:348)
    at org.eclipse.swt.graphics.Device.getScreenDPI(Device.java:408)
    at org.eclipse.swt.graphics.Device.getDPI(Device.java:343)
    at org.eclipse.swt.graphics.Device.init(Device.java:542)
    at org.eclipse.swt.widgets.Display.init(Display.java:2132)
    at org.eclipse.swt.graphics.Device.<init>(Device.java:131)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:701)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:692)
    at org.eclipse.swt.widgets.Display.getDefault(Display.java:1388)
    at org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.createProblemsViews(IDEWorkbenchPlugin.java:394)
    at org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.start(IDEWorkbenchPlugin.java:351)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
    ... 48 more

Solution

  • The problem seems to be:

         [exec] _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
    

    Some tool you use wants to create windows and draw on the screen. That is not possible if you install Jenkins using the standard installer. The Mac installer for Jenkins makes it run as a launch daemon, which is a background service that has no access to the graphics system.

    You have three options:

    • Check if there is a way to invoke the tool in a way that it does not need to draw on the screen. Maybe there is an option to run it in a "headless" mode.
    • If that is not possible, set up a JNLP type slave for Jenkins. Then log in to the Mac from the GUI console and start the slave running in your session. Leave yourself logged in.
    • Alternatively, run the Jenkins master in your GUI session. I have a nice frontend/helper for doing that: https://github.com/stisti/jenkins-app