新布的一台imac下的bamboo agent代理编译机器在启动时报错,报错主要内容为:Can’t connect to window server – not enough permissions .具体解决步骤现做下总结。

先看下报错内容:

 1INFO   | jvm 1    | 2013/12/13 11:14:48 | 2013-04-08 11:14:48,525 FATAL [Thread-2] [AgentBootstrap] Exiting due to fatal exception.
 2INFO   | jvm 1    | 2013/12/13 11:14:48 | java.lang.reflect.InvocationTargetException
 3INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 4INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 5INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 6INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.reflect.Method.invoke(Method.java:597)
 7INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.agent.bootstrap.AgentRunner.run(AgentRunner.java:28)
 8INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.Thread.run(Thread.java:680)
 9INFO   | jvm 1    | 2013/12/13 11:14:48 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agentRegistrationBean' defined in class path resource [applicationContextRemoteAgentStartup.xml]: Invocation of init method failed; nested exception is com.atlassian.util.concurrent.LazyReference$InitializationException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bamboo.plugin.dotnet.nant.NantCapabilityDefaultsHelper': Instantiation of bean failed; nested exception is java.lang.InternalError: Can't connect to window server - not enough permissions.
10INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1170)
11INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
12INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
13INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
14INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
15INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
16INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
17INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
18INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
19INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:88)
20INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.initApplicationContext(RemoteAgent.java:176)
21INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.start(RemoteAgent.java:53)
22INFO   | jvm 1    | 2013/12/13 11:14:48 |   ... 6 more
23INFO   | jvm 1    | 2013/12/13 11:14:48 | Caused by: com.atlassian.util.concurrent.LazyReference$InitializationException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bamboo.plugin.dotnet.nant.NantCapabilityDefaultsHelper': Instantiation of bean failed; nested exception is java.lang.InternalError: Can't connect to window server - not enough permissions.
24INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:152)
25INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:115)
26INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:89)
27INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.plugin.descriptor.TaskModuleDescriptorImpl.getCapabilityDefaultsHelper(TaskModuleDescriptorImpl.java:162)
28INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.v2.build.agent.capability.CapabilityDefaultsHelperImpl.getCapabilityDefaultsHelpers(CapabilityDefaultsHelperImpl.java:78)
29INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.v2.build.agent.capability.CapabilityDefaultsHelperImpl.addDefaultCapabilities(CapabilityDefaultsHelperImpl.java:39)
30INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.v2.build.agent.remote.AgentRegistrationBean.registerAgent(AgentRegistrationBean.java:36)
31INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
32INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
33INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
34INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.reflect.Method.invoke(Method.java:597)
35INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1237)
36INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)
37INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)
38INFO   | jvm 1    | 2013/12/13 11:14:48 |   ... 17 more
39INFO   | jvm 1    | 2013/12/13 11:14:48 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bamboo.plugin.dotnet.nant.NantCapabilityDefaultsHelper': Instantiation of bean failed; nested exception is java.lang.InternalError: Can't connect to window server - not enough permissions.
40INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:451)
41INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:246)
42INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.spring.container.SpringContainerContext.createCompleteComponent(SpringContainerContext.java:90)
43INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.plugin.descriptor.AbstractBambooModuleDescriptor.instantiateClass(AbstractBambooModuleDescriptor.java:108)
44INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.plugin.descriptor.TaskModuleDescriptorImpl$2.create(TaskModuleDescriptorImpl.java:75)
45INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.plugin.descriptor.TaskModuleDescriptorImpl$2.create(TaskModuleDescriptorImpl.java:68)
46INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.util.concurrent.ResettableLazyReference$InternalReference.create(ResettableLazyReference.java:143)
47INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:326)
48INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:146)
49INFO   | jvm 1    | 2013/12/13 11:14:48 |   ... 30 more
50INFO   | jvm 1    | 2013/12/13 11:14:48 | Caused by: java.lang.InternalError: Can't connect to window server - not enough permissions.
51INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
52INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
53INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)
54INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.Runtime.loadLibrary0(Runtime.java:823)
55INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.System.loadLibrary(System.java:1045)
56INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
57INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.security.AccessController.doPrivileged(Native Method)
58INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
59INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
60INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.awt.Component.<clinit>(Component.java:566)
61INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.Class.forName0(Native Method)
62INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.Class.forName(Class.java:171)
63INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.sun.jna.Platform.<clinit>(Platform.java:64)
64INFO   | jvm 1    | 2013/12/13 11:14:48 |   at com.atlassian.bamboo.plugin.dotnet.nant.NantCapabilityDefaultsHelper.<clinit>(NantCapabilityDefaultsHelper.java:20)
65INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
66INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
67INFO   | jvm 1    | 2013/12/13 11:14:48 |   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
68INFO   | jvm 1    | 2013/12/13 11:14:48 |   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
69INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85)
70INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
71INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:752)
72INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:717)
73INFO   | jvm 1    | 2013/12/13 11:14:48 |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)
74INFO   | jvm 1    | 2013/12/13 11:14:48 |   ... 38 more
75ERROR  | wrapper  | 2013/12/13 11:14:48 | JVM exited unexpectedly.</clinit></clinit></clinit></clinit></init></init>

解决方法:

找到bamboo agent 的data目录并修改其中的conf文件,增加如下内容:

1sudo vim /data1/bamboo-agent-home/conf/wrapper.conf
2# The Bamboo Agent home configuration file
3wrapper.java.additional.1=-Dbamboo.home=/data1/bamboo-agent-home
4wrapper.java.additional.2=-Dbamboo.agent.ignoreServerCertName=false
5wrapper.java.additional.3=-Djava.awt.headless=true

其中程序启动脚本如下:

1cat  /App/bamboo-installer/run.sh
2#!/bin/bash
3cd /App/bamboo-installer/;nohup java -Ddisable_agent_auto_capability_detection=true -Dbamboo.home=/data1/bamboo-agent-home -jar atlassian-bamboo-agent-installer-4.4.5.jar http://sgoa.361way.com/bamboo/agentServer/ &

修改完wrapper.conf文件后,sudo sh run.sh重新启动 ,登陆bamboo并用管理员账号在Agent authentication选项approve刚刚的agent即可。过一会儿就会在Online remote agents查看到新加的那台主机。

参考atlassian官方页面