问题
I am trying to build my project using Jenkins to deploy the artifacts to the nexus. I have a Jenkins setup on my macOSX. below is the error, I am getting:
Parsing POMs
[maventest] $ /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Xmx512m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8 -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/usr/share/maven/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/maven /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.26.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar 59985
<===[JENKINS REMOTING CAPACITY]===>channel started
channel stopped
ERROR: Failed to parse POMs java.io.IOException: Remote call on Channel to Maven [/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java, -Xmx512m, -XX:MaxPermSize=128m, -Dfile.encoding=UTF-8, -cp, /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/usr/share/maven/boot/plexus-classworlds-2.4.jar, org.jvnet.hudson.maven3.agent.Maven3Main, /usr/share/maven, /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.26.jar, /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar, 59985] failed at hudson.remoting.Channel.call(Channel.java:727) at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:156) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:770) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586) at hudson.model.Run.execute(Run.java:1593) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:491) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:247) 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:1827) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1045) at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.loadLibraries(Toolkit.java:1605) at java.awt.Toolkit.(Toolkit.java:1627) at java.awt.Color.(Color.java:263) at hudson.util.ColorPalette.(ColorPalette.java:39) at hudson.model.BallColor.(BallColor.java:56) at hudson.model.Result.(Result.java:51) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:171) at com.sun.proxy.$Proxy8.(Unknown Source) at sun.reflect.GeneratedSerializationConstructorAccessor41.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.io.ObjectStreamClass.newInstance(ObjectStreamClass.java:929) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1759) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1969) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349) at java.util.HashMap.readObject(HashMap.java:1030) 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:597) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:979) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1969) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349) at hudson.remoting.UserRequest.deserialize(UserRequest.java:182) at hudson.remoting.UserRequest.perform(UserRequest.java:98) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:680) Finished: FAILURE
I already tried the below solution but it didn't work: http://jenkins-ci.361315.n4.nabble.com/JIRA-Created-HUDSON-5584-java-io-IOException-Remote-call-on-Channel-to-Maven-td1475049.html
Configurations I have:
MAVEN_OPTS:-Xmx1024m
-XX:MaxPermSize=128m
-Dfile.encoding=UTF-8
-Djava.awt.headless=true
output of ps -ef | grep java: /usr/bin/java -Djava.awt.headless=true -jar /Applications/Jenkins/jenkins.war
build command:clean deploy -DaltDeploymentRepository=central::default::http://<user>:<pwd>@<host>:<port>/nexus/content/groups/public/
回答1:
The solution I used was to apply Java 7. What you want to do is add 1.7 to Jenkins. Following these steps I was able to successfully build my project:
- Go to the Oracle Java page and downloaded the 1.7_51 jdk for Mac.
- Opened the dmg and ran the executable.
- On the Mac, this installs the JDK to /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/
- In Jenkins, go to 'Manage Jenkins' > 'Configure System'
- Under the JDK heading, click the button that says JDK Installations
- Under Name type 'JDK 1.7.0_51'
- For JAVA_HOME type '/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/'
- Select Save
- Go to your project and select Configure
- You should now have a JDK drop down near the top of the page.
- Select the JDK you just configured under 'Manage Jenkins'
- Run the build
After doing this, my build successfully ran without the 'Can't connect to window server - not enough permissions error.'
回答2:
This line looks curious:
hudson.model.Executor.run(Executor.java:247) Caused by: java.lang.InternalError:
Can't connect to window server - not enough permissions. at java.lang.ClassLoader
$NativeLibrary.load(Native Method)
I would start with a simpler project, and then add complexity from that point, for the reason of just testing to make sure your basic assumptions are correct.
You might need to set the JVM property : -Djava.awt.headless=true
. By doing that you will disable the (most likely unnecessary) gui libraries that are trying to load.
来源:https://stackoverflow.com/questions/17619829/jenkins-build-failed-on-osx