grundic / teamcity-avatar

Plugin for displaying user avatars in Teamcity
13 stars 4 forks source link

velocity.log is created in the server's bin directory #5

Open yaegor opened 8 years ago

yaegor commented 8 years ago

Plugin version 1.3, TeamCity 8.0+

Once plugin is installed, \bin\velocity.log is created on the server start.

The log file (if at all necessary) should be created under \logs\ but it is better to reroute the logging into the default Log4J used by TeamCity, if possible.

Proof stacktrace with TeamCity 9.1+:

[2015-10-13 14:24:47,832] WARN - inLoader$TeamCityPluginContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'avatarProfileSupplierTemplateController' defined in plugin: teamcity-avatar#avatar-server-1.3.jar!/META-INF/build-server-plugin-teamcity-avatar.xml: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [ru.mail.teamcity.avatar.web.AvatarProfileSupplierTemplateController]: Constructor threw exception; nested exception is org.apache.velocity.exception.VelocityException: Error initializing log: Failed to initialize an instance of org.apache.velocity.runtime.log.AvalonLogChute with the current runtime configuration. at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1115) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at jetbrains.buildServer.plugins.spring.SpringPluginLoader.pluginClassesLoaded(SpringPluginLoader.java:95) at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:120) at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:67) at com.sun.proxy.$Proxy16.pluginClassesLoaded(Unknown Source) at jetbrains.buildServer.plugins.PluginManagerImpl$2.visitPlugin(PluginManagerImpl.java:137) at jetbrains.buildServer.plugins.PluginsCollection.foreachLoadedPlugins(PluginsCollection.java:222) at jetbrains.buildServer.plugins.PluginManagerImpl.firePluginClassesLoaded(PluginManagerImpl.java:135) at jetbrains.buildServer.plugins.PluginManagerImpl.loadPlugins(PluginManagerImpl.java:81) at jetbrains.buildServer.web.plugins.PluginManagerConfigurator.initializePlugins(PluginManagerConfigurator.java:3) at jetbrains.buildServer.web.impl.BuildServerConfigurator.loadConfiguration(BuildServerConfigurator.java:69) at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet$WebApplicationCreatorAndDestroyer.createApplication(TeamCityDispatcherServlet.java:24) at jetbrains.buildServer.maintenance.StartupProcessor.doApplicationStarting(StartupProcessor.java:576) at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStage(StartupProcessor.java:589) at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStageSafe(StartupProcessor.java:543) at jetbrains.buildServer.maintenance.StartupProcessor.processTeamCityLifecycle(StartupProcessor.java:652) at jetbrains.buildServer.maintenance.StartupProcessor.access$000(StartupProcessor.java:587) at jetbrains.buildServer.maintenance.StartupProcessor$1.run(StartupProcessor.java) at java.lang.Thread.run(Thread.java:662) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [ru.mail.teamcity.avatar.web.AvatarProfileSupplierTemplateController]: Constructor threw exception; nested exception is org.apache.velocity.exception.VelocityException: Error initializing log: Failed to initialize an instance of org.apache.velocity.runtime.log.AvalonLogChute with the current runtime configuration. at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:125) at jetbrains.buildServer.spring.InstantiationStrategySelector$1.instantiate(InstantiationStrategySelector.java:77) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:270) ... 32 more Caused by: org.apache.velocity.exception.VelocityException: Error initializing log: Failed to initialize an instance of org.apache.velocity.runtime.log.AvalonLogChute with the current runtime configuration. at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:875) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:262) at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:93) at ru.mail.teamcity.avatar.web.AvatarProfileSupplierTemplateController.initVelocity(AvatarProfileSupplierTemplateController.java:55) at ru.mail.teamcity.avatar.web.AvatarProfileSupplierTemplateController.(AvatarProfileSupplierTemplateController.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) ... 35 more Caused by: org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.AvalonLogChute with the current runtime configuration. at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:220) at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:269) at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:871) ... 44 more Caused by: java.lang.Exception: Error configuring AvalonLogChute : java.io.FileNotFoundException: D:\Work\TeamCity-37221\bin\velocity.log (Access is denied) at org.apache.velocity.runtime.log.AvalonLogChute.initTarget(AvalonLogChute.java:119) at org.apache.velocity.runtime.log.AvalonLogChute.init(AvalonLogChute.java:89) at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:157) ... 46 more

grundic commented 8 years ago

@yaegor, thank you for creating an issue. I will try to investigate and fix it in the short run.

CoolAnkur commented 8 years ago

I'm also facing the same error, can someone tell what's the fix for this?

Caused by: org.apache.velocity.exception.VelocityException: Error initializing log: Failed to initialize an instance of org.apache.velocity.runtime.log.AvalonLogChute with the current runtime configuration. at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:875) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:262) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:646) at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116) at com.amazon.nucleus.utils.comparator.VelocityEngineUtility.createAndInitVelocityEngine(VelocityEngineUtility.java:41) at com.amazon.nucleus.components.comparator.PrimitiveConfigComparator.init(PrimitiveConfigComparator.java:43) 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.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133) ... 92 more Caused by: org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.AvalonLogChute with the current runtime configuration. at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:220) at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:269) at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:871) ... 104 more Caused by: java.lang.Exception: Error configuring AvalonLogChute : java.io.FileNotFoundException: /local/apollo/_env/NucleusService-swit1na.11525493.216027993.986452997/velocity.log (Permission denied) at org.apache.velocity.runtime.log.AvalonLogChute.initTarget(AvalonLogChute.java:119) at org.apache.velocity.runtime.log.AvalonLogChute.init(AvalonLogChute.java:89) at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:157) ... 106 more

grundic commented 8 years ago

Hey... Sorry, have not much time to support the plugin right now, as my current company does not uses Teamcity :'( (but imho, it's ze best CI/CD on the market...)

I'll try to find some time to figure out the root problem and fix it. Sorry for inconvenience.

CoolAnkur commented 8 years ago

Hi Grigory, I did find a fix for the issue I was facing. The issue was that our package was using slf4j for log initialization and velocity below v2.0 fails with slf4j. On changing it to use log4j, the issue got resolved.