about init method syncDesignDocsWithDb in Sprint MVC

22 views
Skip to first unread message

1981...@163.com

unread,
May 5, 2015, 3:51:49 AM5/5/15
to light...@googlegroups.com
when i init dbClient in Spring application as below:
<bean id="dbClient" class="org.lightcouch.CouchDbClient" init-method="syncDesignDocsWithDb" destroy-method="shutdown"/> 

i get error :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbClient' defined in class path resource [com/tts/sdt/eval/spring-context-eval.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
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:628)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
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:744)

so i remove  init-method="syncDesignDocsWithDb", it works. so why need to add "syncDesignDocsWithDb"?

thanks.

Ahmed Yehia

unread,
May 11, 2015, 12:48:48 AM5/11/15
to light...@googlegroups.com
The exception is probably caused due to spring context defined inside a package, try to move it to WEB-INF/spring/*.xml
Here is a working spring example: http://lightcouch.org/downloads/sample.zip
You won't necessarily need init-method="syncDesignDocsWithDb", use it only if you wish to sync design docs every time the client is initialized.

--
You received this message because you are subscribed to the Google Groups "LightCouch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightcouch+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages