我在让Jenkins-build收集器正常工作时遇到问题。我正在使用最新的hygieia-core和最新的hygieia-build-jenkins-collector。我可以使集会,声纳和github收集器运行良好,以及我构建的自定义收集器。我在Mac上运行(目前在本地没有容器),并且正在使用以下命令构建和运行收集器。同样,我让其他收藏家也以相同的方式工作。
mvn clean install package -q
java -jar ~/Sandbox/hygieia-dashboard/collectors/build/jenkins/target/jenkins-build-collector.jar --spring.config.name=jenkins --spring.config.location=/Users/[my username]/Sandbox/hygieia-dashboard/collectors/build/jenkins/application.properties
这是我的 application.properties 文件。
dbname=dashboarddb
# Database HostName - default is localhost
dbhost=localhost
# Database Port - default is 27017
dbport=27018
# MongoDB replicaset
dbreplicaset=false
#dbhostport=[host1:port1,host2:port2,host3:port3]
# Database Username - default is blank
dbusername=dashboarduser
# Database Password - default is blank
dbpassword=dbpassword
# Collector schedule (required)
jenkins.cron=0 0/2 * * * *
# The page size
jenkins.pageSize=1000
# The folder depth - default is 10
jenkins.folderDepth=10
# Jenkins server (required) - Can provide multiple
jenkins.servers[0]=[my jenkins url]
# If using username/token for API authentication
# (required for Cloudbees Jenkins Ops Center) For example,
jenkins.servers[1]=http://[username]:[api-token]@[my jenkins url]
# Another option: If using same username/password Jenkins auth,
# set username/apiKey to use HTTP Basic Auth (blank=no auth)
jenkins.usernames[0]=[username]
jenkins.apiKeys[0]=[api-token]
# Determines if build console log is collected - defaults to false
jenkins.saveLog=true
# Search criteria enabled via properties (max search criteria = 2)
jenkins.searchFields[0]= options.jobName
jenkins.searchFields[1]= niceName
# Timeout values
jenkins.connectTimeout=20000
jenkins.readTimeout=20000
以下是我的输出。我添加了尝试启动时显示错误的位置,但是让我知道您是否想要整个内容。
2019-11-13 14:35:37,756 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hudsonCollectorTask' defined in URL [jar:file:/Users/anderja1/Sandbox/hygieia-dashboard/collectors/build/jenkins/target/jenkins-build-collector.jar!/com/capitalone/dashboard/collector/HudsonCollectorTask.class]: Unsatisfied dependency expressed through constructor argument with index 4 of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository]: No qualifying bean of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository] is defined: expected single matching bean but found 2: collItemConfigHistoryRepository,sonarProfileRepostory; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository] is defined: expected single matching bean but found 2: collItemConfigHistoryRepository,sonarProfileRepostory
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:185) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347) [spring-boot-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:295) [spring-boot-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1112) [spring-boot-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1101) [spring-boot-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
at com.capitalone.dashboard.Application.main(Application.java:16) [jenkins-build-collector.jar!/:3.1.2-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) [jenkins-build-collector.jar!/:3.1.2-SNAPSHOT]
at java.lang.Thread.run(Thread.java:819) [na:1.8.0_232]
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository] is defined: expected single matching bean but found 2: collItemConfigHistoryRepository,sonarProfileRepostory
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1126) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
... 24 common frames omitted
java.lang.reflect.InvocationTargetException
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:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:819)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hudsonCollectorTask' defined in URL [jar:file:/Users/anderja1/Sandbox/hygieia-dashboard/collectors/build/jenkins/target/jenkins-build-collector.jar!/com/capitalone/dashboard/collector/HudsonCollectorTask.class]: Unsatisfied dependency expressed through constructor argument with index 4 of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository]: No qualifying bean of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository] is defined: expected single matching bean but found 2: collItemConfigHistoryRepository,sonarProfileRepostory; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository] is defined: expected single matching bean but found 2: collItemConfigHistoryRepository,sonarProfileRepostory
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:295)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1112)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1101)
at com.capitalone.dashboard.Application.main(Application.java:16)
... 6 more
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.capitalone.dashboard.repository.CollItemConfigHistoryRepository] is defined: expected single matching bean but found 2: collItemConfigHistoryRepository,sonarProfileRepostory
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1126)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
... 24 more
除非该收集器的工作方式与其他收集器不同,否则我看不到任何可能做错的事情,但是我很可能会忽略某些事情。让我知道您是否需要有关此的更多信息。预先感谢!
答案 0 :(得分:0)
我已经弄清楚了这个问题。我向Hygieia的build-jenkins-collector提出了一个问题。它被标记为错误,因此希望可以尽快修复。可以在此处跟踪问题:https://github.com/Hygieia/hygieia-build-jenkins-collector/issues/20
简而言之,我注释掉了src/main/java/com/capitalone/dashboard/repository/SonarProfileRepostory.java
我不确定代码有什么用途,但是声纳和Jenkins构建收集器在没有它的情况下就可以正常工作,并且上述错误会消失。