timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-5584] Automatically add -Djava.awt.headless=true on Mac? #481

Open timja opened 14 years ago

timja commented 14 years ago

It seems as if this version requires more rights than the ones before. Here is the Console output:

Checkout:workspace / /var/empty/.hudson/jobs/OSGi-Inspector nightly All/workspace - hudson.remoting.LocalChannel@7f59d6
Last Built Revision: Revision 9d1801d2a07ce07fae1a738f81c9cf1c80014288 (origin/master)
Checkout:workspace / /var/empty/.hudson/jobs/OSGi-Inspector nightly All/workspace - hudson.remoting.LocalChannel@7f59d6
GitAPI created
Env: _=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java
Env: __CF_USER_TEXT_ENCODING=0x4F:0:0
Env: BUILD_ID=2010-02-09_22-12-42
Env: BUILD_NUMBER=9
Env: BUILD_TAG=hudson-OSGi-Inspector nightly All-9
Env: BUILD_URL=http://localhost:8080/hudson/job/OSGi-Inspector%20nightly%20All/9/
Env: CATALINA_HOME=/Library/Tomcat
Env: CATALINA_OPTS=-server -Djava.awt.headless=true -Xmx512m
Env: CATALINA_PID=/Library/Tomcat/logs/tomcat.pid
Env: CLASSPATH=
Env: EXECUTOR_NUMBER=0
Env: HOME=/var/empty
Env: HUDSON_HOME=/var/empty/.hudson
Env: HUDSON_URL=http://localhost:8080/hudson/
Env: JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/home/
Env: JAVA_MAIN_CLASS_99=org.apache.catalina.startup.Bootstrap
Env: JOB_NAME=OSGi-Inspector nightly All
Env: JOB_URL=http://localhost:8080/hudson/job/OSGi-Inspector%20nightly%20All/
Env: LOGNAME=_appserver
Env: MAVEN_OPTS=-Xmx512m
Env: NODE_NAME=
Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
Env: PATH+JDK=/System/Library/Frameworks/JavaVM.framework/home//bin
Env: PWD=/
Env: SHELL=/usr/bin/false
Env: SHLVL=2
Env: TMPDIR=/var/folders/zz/zzzivhrRnAmviuee+++Hk++2w/Tmp/
Env: USER=_appserver
Env: WORKSPACE=/var/empty/.hudson/jobs/OSGi-Inspector nightly All/workspace
Cloning the remote Git repository
Cloning repository origin
$ /usr/local/git/bin/git clone -o origin http://github.com/mirkojahn/OSGi-Inspector.git "/var/empty/.hudson/jobs/OSGi-Inspector nightly All/workspace"
Fetching upstream changes from http://github.com/mirkojahn/OSGi-Inspector.git
[workspace] $ /usr/local/git/bin/git fetch -t http://github.com/mirkojahn/OSGi-Inspector.git +refs/heads/:refs/remotes/origin/
[workspace] $ /usr/local/git/bin/git ls-tree HEAD
Seen branch in repository origin/master
Commencing build of Revision 9d1801d2a07ce07fae1a738f81c9cf1c80014288 (origin/master)
GitAPI created
Env: _=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java
Env: __CF_USER_TEXT_ENCODING=0x4F:0:0
Env: BUILD_ID=2010-02-09_22-12-42
Env: BUILD_NUMBER=9
Env: BUILD_TAG=hudson-OSGi-Inspector nightly All-9
Env: BUILD_URL=http://localhost:8080/hudson/job/OSGi-Inspector%20nightly%20All/9/
Env: CATALINA_HOME=/Library/Tomcat
Env: CATALINA_OPTS=-server -Djava.awt.headless=true -Xmx512m
Env: CATALINA_PID=/Library/Tomcat/logs/tomcat.pid
Env: CLASSPATH=
Env: EXECUTOR_NUMBER=0
Env: HOME=/var/empty
Env: HUDSON_HOME=/var/empty/.hudson
Env: HUDSON_URL=http://localhost:8080/hudson/
Env: JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/home/
Env: JAVA_MAIN_CLASS_99=org.apache.catalina.startup.Bootstrap
Env: JOB_NAME=OSGi-Inspector nightly All
Env: JOB_URL=http://localhost:8080/hudson/job/OSGi-Inspector%20nightly%20All/
Env: LOGNAME=_appserver
Env: MAVEN_OPTS=-Xmx512m
Env: NODE_NAME=
Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
Env: PATH+JDK=/System/Library/Frameworks/JavaVM.framework/home//bin
Env: PWD=/
Env: SHELL=/usr/bin/false
Env: SHLVL=2
Env: TMPDIR=/var/folders/zz/zzzivhrRnAmviuee+++Hk++2w/Tmp/
Env: USER=_appserver
Env: WORKSPACE=/var/empty/.hudson/jobs/OSGi-Inspector nightly All/workspace
Checking out Revision 9d1801d2a07ce07fae1a738f81c9cf1c80014288 (origin/master)
[workspace] $ /usr/local/git/bin/git checkout -f 9d1801d2a07ce07fae1a738f81c9cf1c80014288
[workspace] $ /usr/local/git/bin/git tag -a -f -m "Hudson Build #9" hudson-OSGi-Inspector_nightly_All-9
Recording changes in branch origin/master
[workspace] $ /usr/local/git/bin/git log --pretty=format:%H 9d1801d2a07ce07fae1a738f81c9cf1c80014288..9d1801d2a07ce07fae1a738f81c9cf1c80014288
Parsing POMs
[workspace] $ /System/Library/Frameworks/JavaVM.framework/home//bin/java -Xmx512m -cp /var/empty/.hudson/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.345.jar:/usr/share/java/maven-2.2.0/boot/classworlds-1.1.jar hudson.maven.agent.Main /usr/share/java/maven-2.2.0/ /Library/Tomcat/webapps/hudson/WEB-INF/lib/remoting-1.345.jar /var/empty/.hudson/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.345.jar 49950 /var/empty/.hudson/plugins/maven-plugin/WEB-INF/lib/maven2.1-interceptor-1.2.jar
<===[HUDSON REMOTING CAPACITY]===>channel started
channel stopped
ERROR: Failed to parse POMs
java.io.IOException: Remote call on Channel to Maven [/System/Library/Frameworks/JavaVM.framework/home//bin/java, -Xmx512m, -cp, /var/empty/.hudson/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.345.jar:/usr/share/java/maven-2.2.0/boot/classworlds-1.1.jar, hudson.maven.agent.Main, /usr/share/java/maven-2.2.0/, /Library/Tomcat/webapps/hudson/WEB-INF/lib/remoting-1.345.jar, /var/empty/.hudson/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.345.jar, 49950, /var/empty/.hudson/plugins/maven-plugin/WEB-INF/lib/maven2.1-interceptor-1.2.jar] failed
at hudson.remoting.Channel.call(Channel.java:560)
at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:156)
at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:480)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416)
at hudson.model.Run.run(Run.java:1198)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.lang.InternalError: Can't connect to window server - not enough permissions.
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1824)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1725)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1509)
at java.awt.Toolkit.(Toolkit.java:1530)
at java.awt.Color.(Color.java:250)
at hudson.util.ColorPalette.(ColorPalette.java:39)
at hudson.model.BallColor.(BallColor.java:54)
at hudson.model.Result.(Result.java:41)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at $Proxy2.(Unknown Source)
at sun.reflect.GeneratedSerializationConstructorAccessor38.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:501)
at java.io.ObjectStreamClass.newInstance(ObjectStreamClass.java:896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1704)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at java.util.HashMap.readObject(HashMap.java:1067)
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:592)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1812)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at hudson.remoting.UserRequest.deserialize(UserRequest.java:178)
at hudson.remoting.UserRequest.perform(UserRequest.java:98)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:270)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
at java.lang.Thread.run(Thread.java:613)
Finished: FAILURE


Originally reported by mirkojahn, imported from: Automatically add -Djava.awt.headless=true on Mac?
  • status: Open
  • priority: Minor
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 14 years ago

mirkojahn:

I tried it with 1.341 again and everything worked perfectly. I haven't tried the versions in between though. Hope that helps a little.

timja commented 14 years ago

kohsuke:

I don't have a Mac to test this handy, but the root cause of the problem is that your Maven process cannot communicate with the current window station. You can work around this by adding "-Djava.awt.headless=true" to your MAVEN_OPTS.

I'm not sure if it's at all possible for Hudson to do this for you without causing some issues in other situations.

timja commented 14 years ago

kohsuke:

The only remaining issue is if it's possible for Hudson to set this system property on behalf of the user. Changing the issue to reflect this.

timja commented 14 years ago

mirkojahn:

Well, maybe it is not necessary to specify this for all Mac instances. If you take a look at the environment, you'll see that I had to define "CATALINA_OPTS=-server -Djava.awt.headless=true -Xmx512m" anyway. So the tomcat (in my case) already knew how to get started. I think it would be best to just take the options already passed to the running JVM as input for the spawned process (as done for -Xmx already - as it seems). With this, the "fix" is not limited to any OS, but on the general configuration of the server.

timja commented 14 years ago

mirkojahn:

Another thing that puzzled me is the fact, that it worked in version 1.341. So something must have changed in order to require "java.awt.headless=true".

timja commented 13 years ago

rpomeroy:

I'm on a Mac deploying to Virgo (Tomcat) M03 and I get an icon in the doc which tells you something thinks it needs a window server. This wasn't the case deploying 1.3x on Virgo (Tomcat) M02 or M03. Launching war from the command line doesn't result in a dock icon for either. Adding -Djava.awt.headless=true does indeed eliminate the dock icon - but I too would like to know where a dependency on AWT or Swing code creeped in. I don't want to have to mod Virgo for every deployment. Time to explore the code.

timja commented 13 years ago

rpomeroy:

One other thing - this is a Jenkins out of the box - before configuring the Maven runtime.

timja commented 11 years ago

josht:

I was able to work around this issue by adding the -Djava.awt.headless=true to the JVM Options of the (Advanced) Launch Method section of the build slave configuration.

timja commented 11 years ago

fabb:

Thank you for the workaround, Joshua.