Asqatasun/Web-Snapshot

Error: "initialization of bean failed" in /WEB-INF/conf/beans-websnapshot.xml

Opened this issue · 0 comments

dzc34 commented

Observed behaviour

Error in catalina.out

Error creating bean with name 'imageDataService' 
defined in ServletContext resource [/WEB-INF/conf/beans-websnapshot.xml]
 Initialization of bean failed

catalina.out

01-01-2017 23:5229884 859  INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: my_database.image
01-01-2017 23:5229884 859  INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [is_canonical, id, height, status, width, raw_data, id_url, date_of_creation]
01-01-2017 23:5229886 861  INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: my_database.url
01-01-2017 23:5229886 861  INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [id, url]
01-01-2017 23:5229911 886  INFO  org.springframework.web.context.support.XmlWebApplicationContext  - Bean 'entityManagerFactory' of type [class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-01-2017 23:5229942 917  INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5b0754f6: defining beans [exposedPropertiesConfigurer,entityManagerFactory,dataSource,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,transactionalMethods,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,txAdvice,urlDAO,imageDAO,imageDataService,urlDataService,urlFactory,imageFactory,snapshotCreator,threadPoolTaskExecutor]; root of factory hierarchy
01-01-2017 23:5230155 1130 INFO  org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor  - Initializing ExecutorService  'threadPoolTaskExecutor'
01-01-2017 23:5230158 1133 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5b0754f6: defining beans [exposedPropertiesConfigurer,entityManagerFactory,dataSource,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,transactionalMethods,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,txAdvice,urlDAO,imageDAO,imageDataService,urlDataService,urlFactory,imageFactory,snapshotCreator,threadPoolTaskExecutor]; root of factory hierarchy
01-01-2017 23:5230163 1138 INFO  org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor  - Shutting down ExecutorService 'threadPoolTaskExecutor'
01-01-2017 23:5230163 1138 INFO  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean  - Closing JPA EntityManagerFactory for persistence unit 'webthumbnail-pu'
01-01-2017 23:5230163 1138 INFO  org.hibernate.impl.SessionFactoryImpl  - closing
01-01-2017 23:5230164 1139 ERROR org.springframework.web.context.ContextLoader  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'imageDataService' defined in ServletContext resource [/WEB-INF/conf/beans-websnapshot.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'long' for property 'lifetime'; nested exception is java.lang.NumberFormatException: For input string: "$LIFETIME_IN_DAY"
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5010)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5504)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'long' for property 'lifetime'; nested exception is java.lang.NumberFormatException: For input string: "$LIFETIME_IN_DAY"
	at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:490)
	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
	... 24 more
Caused by: java.lang.NumberFormatException: For input string: "$LIFETIME_IN_DAY"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Long.parseLong(Long.java:430)
	at java.lang.Long.valueOf(Long.java:540)
	at org.springframework.util.NumberUtils.parseNumber(NumberUtils.java:158)
	at org.springframework.beans.propertyeditors.CustomNumberEditor.setAsText(CustomNumberEditor.java:115)
	at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:434)
	at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:406)
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:163)
	at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)

Steps to reproduce the behaviour

git clone https://github.com/Asqatasun/Web-Snapshot.git
cd Web-Snapshot
git checkout docker
docker/compile_and_build_docker_image.sh -l -s ${PWD} -d docker/SNAPSHOT-local_from-Ubuntu
docker logs  web.snapshot 

Your configuration

Experimental docker branch