Verigreen / verigreen

Verigreen is a lightweight, server side solution for verification of git commits. It is a gated check-in process which will not allow any failed CI commit to go into an integration/release/any protected branch. We keep it green (hence the name).
Apache License 2.0
57 stars 19 forks source link

Verigreen on Tomcat failed on startup (com.verigreen.collector.spring.CollectorSpringContextLoaderListener) #127

Closed dkultasev closed 7 years ago

dkultasev commented 7 years ago

I am trying to setup tested/delayed commits with Windows/Tomcat/Verigreen/Bitbucket.

I used following config file as an example. Following params I can't understand:

My current configuration file looks like:

# Jenkins Configuration
jenkins.url=http://localhost:8080/
jenkins.user=d
jenkins.password=da9085a7bd334a187d1cf9d12e10ccce
##############Changes in this field will be effected after save (no restart is needed)################
#Warning! Do not change the jobName parameter while there are commits being verified in the system!
jenkins.jobName=btbckt_test
jenkins.branchParamName=SCM_BRANCH
#The maximum number of seconds Verigreen waits for a verification build to complete.
jenkins.timeoutInSeconds=3600

# Git configuration
git.repositoryLocation=http://Dmitrij@localhost:7990/scm/tmp/tmp.git
##############Changes in this field will be effected after save (no restart is needed)################
git.protectedBranches=refs/heads/master
##############Changes in this field will be effected after save (no restart is needed)################
git.permittedUsers=dm@gmail.com

#JGitOperator configuration
#These sets Verigreen's user.name and user.email git configuration parameters.
commited.by.collector=VeriGreen
email.address=verigreen@gmail.com  # this is fake email. I just entered something here.

# Mail Configuration
#The SMTP server Verigreen will use to send its emails.
#SMTP authentication is not currently supported.
mail.server=smtp.gmail.com

#Collector Display Name
collectors=VeriGreen  # I am not sure what is this parameter is used for. It seems to me that it is what will be displayed in emails and so on
#The URL of the Verigreen collector.
#This is the address that need be configured in the Verigreen git-hook configuration file, hook.properties.
# Add /<warName> after the port number, if deployed as war.
#This parameter is required for Verigreen to work.
collector.address=http://localhost:8081/verigreen/rest # I do not know what this param is used for. I've used the expeceted URL that verigreen will be run on + "/rest". The name of the war file is verigreen.war

# Verigreen Internal Configuration
#CacheCleanerJob and BranchCleanerJob configuration.
#0 => Remove all but Running commits.
daysThreashold=3
#How many hours to wait before Verigreen runs its cache and branch cleaning jobs.
repeatHourlyForever=24

#JobScheduler configuration
#The number of seconds after which Verigreen wakes up to process any undone items in the commit item list.
repeatSecondlyForever=10
#The number of iterations to wait before attempting to re-trigger a new build for a verification.
timeout.counter=4
#The number of Jenkins build re-trigger attempts before it is setting the commit as Trigger_Failed.
default_count=3

#Queue Manager:
#The maximum number of commits Verigreen will run verification for at the same time.
#Set this to no more than the number of concurrent verification builds that Jenkins can run simultaneously.
number.commits=5

#The number of attempts Verigreen makes to verify the configured Jenkins Job exists.
job.retry.counter=3

#Force push password hash
hash.password=c21e299d9ec8db9718e162aca10689317d94f34f

##############Changes in this field will be effected after save (no restart is needed)################
#enable/disable retry of Failed commits
full.push=disabled

#Additional parameters that be be sent to Jenkins.
#Set value to 'true' (without quotes) to send the key/value pair using below key name.
#Alternatively, set the value to the Jenkins String Parameter name.
jenkinsparam.mode=params
jenkinsparam.longid=false
jenkinsparam.parent=false
jenkinsparam.protected=false
jenkinsparam.commitid=false
jenkinsparam.committer=false

# FAQ Page Configuration
#Enable offline FAQ page
#In case the Internet connection is limited or restricted this parameter should be set to true in order to have access to the FAQ page
#If there are no restrictions this parameter should be set to false, the FAQ page being accessed directly on the github page
#Set to true and provide below offline URLs and files as needed.
faq.offline=true  # added this param as it was asking for it
faq.offline.git=faqpage.html#q-i-got-a-git_failure-status-what-does-it-mean
faq.offline.timeout=faqpage.html#q-i-got-a-time_out-status-what-does-it-mean
#These properties should not be changed
faq.online.git=https://github.com/Verigreen/verigreen/wiki/Verigreen-FAQ#q-i-got-a-git_failure-status-what-does-it-mean
faq.online.trigger=https://github.com/Verigreen/verigreen/wiki/Verigreen-FAQ#q-i-got-a-trigger_failed-status-what-does-it-mean
faq.online.timeout=https://github.com/Verigreen/verigreen/wiki/Verigreen-FAQ#q-i-got-a-time_out-status-what-does-it-mean

faq.offline.git=faqpage.html#q-i-got-a-git_failure-status-what-does-it-mean
faq.offline.trigger=faqpage.html#q-i-got-a-trigger_failed-status-what-does-it-mean
faq.offline.timeout=faqpage.html#q-i-got-a-time_out-status-what-does-it-mean

And this is the log file:

Sep 19, 2017 12:10:56 PM org.apache.catalina.core.ApplicationContext log
INFO: Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ environment.
Sep 19, 2017 12:10:59 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Sep 19, 2017 12:10:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Sep 19, 2017 12:10:59 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.verigreen.collector.spring.CollectorSpringContextLoaderListener
java.lang.IllegalArgumentException
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:110)
    at org.springframework.core.LocalVariableTableParameterNameDiscoverer.getParameterNames(LocalVariableTableParameterNameDiscoverer.java:85)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:193)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at com.verigreen.common.spring.SpringContextLoader.loadContext(SpringContextLoader.java:56)
    at com.verigreen.collector.spring.CollectorSpringContextLoaderListener.loadParentContext(CollectorSpringContextLoaderListener.java:34)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5110)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 19, 2017 12:10:59 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.verigreen.collector.core.ServerListener
java.lang.NullPointerException
    at com.verigreen.common.spring.SpringContextHolder.getBean(SpringContextHolder.java:57)
    at com.verigreen.collector.spring.CollectorApi.getBean(CollectorApi.java:132)
    at com.verigreen.collector.spring.CollectorApi.getCache(CollectorApi.java:38)
    at com.verigreen.collector.core.ServerListener.contextInitialized(ServerListener.java:32)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5110)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 19, 2017 12:10:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Log4jServletContextListener ensuring that Log4j starts up properly.
Sep 19, 2017 12:10:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Log4jServletContextListener ensuring that Log4j shuts down properly.
Sep 19, 2017 12:10:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Removing LoggerContext for [collector].
Sep 19, 2017 12:10:59 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class com.verigreen.collector.core.ServerListener
java.lang.NullPointerException
    at com.verigreen.common.spring.SpringContextHolder.getBean(SpringContextHolder.java:57)
    at com.verigreen.collector.spring.CollectorApi.getBean(CollectorApi.java:132)
    at com.verigreen.collector.spring.CollectorApi.getJobScheduler(CollectorApi.java:73)
    at com.verigreen.collector.core.ServerListener.contextDestroyed(ServerListener.java:40)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5157)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5830)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:149)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 19, 2017 12:10:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Sep 19, 2017 12:12:35 PM org.apache.catalina.core.ApplicationContext log
INFO: Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ environment.
Sep 19, 2017 12:12:38 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Sep 19, 2017 12:12:38 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Sep 19, 2017 12:12:39 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.verigreen.collector.spring.CollectorSpringContextLoaderListener
java.lang.IllegalArgumentException
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:110)
    at org.springframework.core.LocalVariableTableParameterNameDiscoverer.getParameterNames(LocalVariableTableParameterNameDiscoverer.java:85)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:193)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at com.verigreen.common.spring.SpringContextLoader.loadContext(SpringContextLoader.java:56)
    at com.verigreen.collector.spring.CollectorSpringContextLoaderListener.loadParentContext(CollectorSpringContextLoaderListener.java:34)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5110)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 19, 2017 12:12:39 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.verigreen.collector.core.ServerListener
java.lang.NullPointerException
    at com.verigreen.common.spring.SpringContextHolder.getBean(SpringContextHolder.java:57)
    at com.verigreen.collector.spring.CollectorApi.getBean(CollectorApi.java:132)
    at com.verigreen.collector.spring.CollectorApi.getCache(CollectorApi.java:38)
    at com.verigreen.collector.core.ServerListener.contextInitialized(ServerListener.java:32)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5110)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 19, 2017 12:12:39 PM org.apache.catalina.core.ApplicationContext log
INFO: Log4jServletContextListener ensuring that Log4j starts up properly.
Sep 19, 2017 12:12:39 PM org.apache.catalina.core.ApplicationContext log
INFO: Log4jServletContextListener ensuring that Log4j shuts down properly.
Sep 19, 2017 12:12:39 PM org.apache.catalina.core.ApplicationContext log
INFO: Removing LoggerContext for [collector].
Sep 19, 2017 12:12:39 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class com.verigreen.collector.core.ServerListener
java.lang.NullPointerException
    at com.verigreen.common.spring.SpringContextHolder.getBean(SpringContextHolder.java:57)
    at com.verigreen.collector.spring.CollectorApi.getBean(CollectorApi.java:132)
    at com.verigreen.collector.spring.CollectorApi.getJobScheduler(CollectorApi.java:73)
    at com.verigreen.collector.core.ServerListener.contextDestroyed(ServerListener.java:40)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5157)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5830)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:149)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 19, 2017 12:12:39 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
soninob commented 7 years ago

Hey @dkultasev - few questions: which Java version are yuo using? (If it is Java 8, it is not supported) you should have a clone repository where you the collector up and running, and then insert the loacl value in git.repositoryLocation. If your git user is dm@gmail.com, then I suggest you remove it from the git.permittedUsers, otherwise all your pushes will by pass VG (no triggering will be made). collectors is the name that will displayed in the UI, should be something like project name. collector.address should be pointing to VG application + /rest to work properly.

Waiting to hear from you, thanks.

dkultasev commented 7 years ago

Hi @soninob , the issue was in Java version. Mine was v8, downloaded v7.45 and everything is seems to be working

soninob commented 7 years ago

good! let me know if you need anymore help :-) closing....