Spring MVC code- Throws HSEARCH000103 exception when it is being deployed

余生颓废 提交于 2019-12-13 13:45:29

问题


In our springmvc website, we are using hibernate search with lucene. There are no issues when i compile the code, but when i try to deploy the code on a tomcat 7.0.52 running on Ubuntu 14.04 64bit server, i get the following exceptions

INFO: Initializing Spring root WebApplicationContext Aug 20, 2015 1:20:10 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Cannot resolve reference to bean 'userManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.atcm.service.impl.UserManagerImpl.setUserDao(com.atcm.dao.UserDao); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.search.SearchException: HSEARCH000103: Unable to initialize IndexManager com.atcm.model.User at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:627) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1114) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1017) 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:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760).............

The hibernate properties file is as follows,

app.search.index.basedir=target/index hibernate.search.default.directory_provider=filesystem hibernate.search.default.locking_strategy=simple hibernate.search.default.exclusive_index_use=true hibernate.search.lucene_version=LUCENE_35 hibernate.search.analyzer=org.apache.lucene.analysis.en.EnglishAnalyzer hibernate.search.worker.batch_size=100

Any help , will be much appreciated.


回答1:


Check this property in the configuration file and make sure it points to an existing folder

hibernate.search.default.indexBase = path/to/index/folder

If the folder exists, check the permissions and make sure you can write on it

For sure, check if this property exists in the hibernate-context

<prop key="hibernate.search.default.indexBase">$CONF{hibernate.search.default.indexBase}</prop>



回答2:


I suspect this property is intended for development:

app.search.index.basedir=target/index

Try changing target/index for a directory that tomcat can read and write.



来源:https://stackoverflow.com/questions/32133444/spring-mvc-code-throws-hsearch000103-exception-when-it-is-being-deployed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!