【发布时间】:2014-04-30 15:10:38
【问题描述】:
我正在实现一个页面,该页面有一个搜索字段并使用 spring 调用弹性搜索服务。
使用 spring-elasticsearch (https://github.com/dadoonet/spring-elasticsearch) 提供的 spring bean 完成与 elasticsearch 引擎的连接:
<elasticsearch:client id="esClient" esNodes="localhost:9300" />
这工作得很好,但我想将我的引擎移动到不同的服务器,所以为了开发和测试,我使用这个 https://github.com/caruccio/openshift-elasticsearch 在 Openshift 中使用弹性搜索创建了一个应用程序,并更改了传输的客户端 esNode 链接。这里的问题总是给我这样的错误(或类似的错误):
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.projectx.standard.services.common.SearchEngineService com.projectx.standard.app.controler.common.IndexController.searchEngineService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchEngineService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.elasticsearch.client.Client com.projectx.standard.services.common.implementation.ElasticSearchServiceImpl.esClient; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esClient': Invocation of init method failed; nested exception is java.lang.NumberFormatException: For input string: "//elastic-projectxserver.rhcloud.com/"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
我认为问题出在链接中,因为我在 esNodes 字段中使用了 http://...,但我不确定。
有人知道如何把应用程序连接到openshift中的引擎吗?
顺便说一句,我发现这个 https://github.com/spring-projects/spring-data-elasticsearch 看起来很有趣,但我不知道这是否有助于解决我的问题或值得改变!
提前致谢
【问题讨论】:
标签: java spring spring-mvc elasticsearch openshift