`
Daniel_maxx
  • 浏览: 1433 次
社区版块
存档分类
最新评论

solr5.2.1整合web项目,执行查询时报语法错误。求解!!!

阅读更多
严重: Servlet.service() for servlet [mvc-dispatcher] in context with path [/webShopManager] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Illegal character in scheme name at index 0: 127.0.0.1:8080/code1/select?q=%C3%A4%C2%BD%C2%A0%C3%A4%C2%BB%C2%AC&start=0&rows=10&hl=true&hl.simple.pre=%3Cfont+color+%3D+%27red%27%3E&hl.simple.post=%3C%2Ffont%3E&wt=javabin&version=2] with root cause
java.net.URISyntaxException: Illegal character in scheme name at index 0: 127.0.0.1:8080/code1/select?q=%C3%A4%C2%BD%C2%A0%C3%A4%C2%BB%C2%AC&start=0&rows=10&hl=true&hl.simple.pre=%3Cfont+color+%3D+%27red%27%3E&hl.simple.post=%3C%2Ffont%3E&wt=javabin&version=2
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.checkChar(URI.java:3012)
at java.net.URI$Parser.parse(URI.java:3028)
at java.net.URI.<init>(URI.java:595)
at java.net.URI.create(URI.java:857)
at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
at org.apache.solr.client.solrj.impl.HttpSolrClient.createMethod(HttpSolrClient.java:333)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:235)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:227)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:135)
at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:943)
at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:958)
at com.hisun.manager.controller.setting.SolrjController.searchByKeywords(SolrjController.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.hisun.base.filter.CookieFilter.doFilter(CookieFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at com.hisun.base.filter.intercepter.MyFilterSecurityInterceptor.invoke(MyFilterSecurityInterceptor.java:57)
at com.hisun.base.filter.intercepter.MyFilterSecurityInterceptor.doFilter(MyFilterSecurityInterceptor.java:46)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(Deleg
atingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:744)
更多 0
0
0
分享到:
评论
2 楼 masuweng 2017-03-23  
把项目附上吧,正好这几天刚开始学习solr,参考参考
1 楼 Daniel_maxx 2017-03-23  
下面是java代码
@RequestMapping(value = "/searchByKeywords.do", produces = "text/plain; charset=UTF-8")
@ResponseBody
private List<String> searchByKeywords(String keywords, Integer start,
Integer rows) throws SolrServerException, IOException {

SolrQuery query = new SolrQuery(keywords);
System.out.println("------solo------"+query);
if (null == start) {
query.setStart(0);
} else {
query.setStart(start);
}
if (null == rows) {
query.setRows(10);
} else {
query.setRows(rows);
}
// 高亮
query.setHighlight(true);
query.setHighlightSimplePre("<font color = 'red'>");
query.setHighlightSimplePost("</font>");
System.err.println("abcde--------------" + query);

// 查询
QueryResponse response = solrClient.query(query);
List<SolrDocument> results = response.getResults();
List<String> list = new ArrayList<String>();
for (SolrDocument solrDocument : results) {
list.add((String) solrDocument.getFieldValue("keywords"));
}

return list;
}

相关推荐

    mmseg4j完美适配solr5.2.1

    《mmseg4j在Solr5.2.1中的完美应用》 在现代搜索引擎和文本分析领域,中文分词是至关重要的一步,它直接影响到搜索结果的准确性和用户体验。mmseg4j是一款针对中文的高效分词库,而Solr作为Apache Lucene项目的一...

    solr-5.2.1.tgz

    2. **New Query Parser**: 引入了 DisMaxQParserPlugin 的增强版,称为 "edismax",它提供了更灵活的查询语法,增强了用户查询体验。 3. **Paging and Faceting**: 改进了分页和分面搜索的性能,使得在大量数据集上...

    [免费]solr-5.2.1.war下载

    solr-5.2.1 war包

    solr5.2.1.jar

    solr-analysis-5.2.1.jar需要的朋友请下载

    solr5.2.1.tgz

    Solr是一个独立的企业级搜索应用服务器,它对外提供类似于Web-service的API接口。用户可以通过http请求,向搜索引擎服务器提交一定格式的XML文件,生成索引;也可以通过Http Get操作提出查找请求,并得到XML格式的...

    solr5.2.1之IK分词器

    网上其他关于IK分词器的介绍一般都是从文本文件中加载词库,我根据网上下载的ik分词器jar包,反编译后,修改了源码,支持从数据库定时增量导入词库。同时也支持从文本文件中导入词库,但没有定时增量导入的功能。

    solrCloud5.2.1 + tomcat7 + zookeeper3.4.6

    将`solr-5.2.1\dist`和`solr-5.2.1\server\lib\ext`下的jar包复制到`solr_home_1\server\solr\WEB-INF\lib`。 8. 至此,单机版配置完成。启动Tomcat,访问`http://localhost:8080/solr`验证。 **2.2 配置多...

    SolrCloud5.2.1+tomcat7+zookeeper3.4.6搭建教程

    **步骤7:** 将`solr-5.2.1\dist`和`solr-5.2.1\server\lib\ext`目录下的所有`jar`包复制到`solr_home_1\server\solr\WEB-INF\lib`目录下。 **步骤8:** 启动`tomcat7_ser1`,通过访问`http://localhost:8080/solr`来...

    solr-5.2.1-src.tgz源码

    3. 用Ant把Solr源码转换为MyEclipse Web项目 进入Solr源码的根目录 在cmd中输入ant eclipse, 按回车后你将会看到如下画面, 如果你的c:\Users\用户名\.ant\lib下没有ivy jar包的话 此时你按它说的那样需输入ant ...

    Solr3.5整合Tomcat

    总之,Solr 3.5 整合到 Tomcat 可以让你利用 Tomcat 的稳定性和灵活性来运行和管理 Solr 搜索服务,从而在 web 应用中实现高效的全文检索功能。通过理解 Solr 的配置和 Tomcat 的部署机制,你可以更好地定制和扩展你...

    基于Solr的多表join查询加速方法

    - **BitQuery.java**:这可能是一个自定义查询实现,用于在Solr中执行高效的位运算,用于处理大量的文档筛选。位运算在大数据集上可以提供比常规查询更快的速度,尤其是在处理join场景时,可以通过位向量表示相关...

    solr-5.2.1.part1.rar 编译第1部分,共2部分

    3. 用Ant把Solr源码转换为MyEclipse Web项目 进入Solr源码的根目录 在cmd中输入ant eclipse, 按回车后你将会看到如下画面, 如果你的c:\Users\用户名\.ant\lib下没有ivy jar包的话 此时你按它说的那样需输入ant ...

    solr 3.5 msg整合可直接使用

    "solr 3.5 msg整合可直接使用"的标题意味着这个压缩包包含了一个已经配置好并且可以立即运行的Solr 3.5实例,特别地,它可能已经集成了某种消息处理或通信机制(可能指的是message5_1),以便于数据的导入和检索。...

    solr查询语法.pdf

    Solr是一种基于Apache Lucene的开源搜索引擎,提供了丰富的查询语法来满足各种搜索需求。在了解Solr查询语法前,我们首先需要了解几个核心概念。 首先,Solr的查询解析是通过queryParser来配置的,通常使用默认配置...

    solr查询语法

    ### Solr查询语法详解 #### 一、Core Query Param 查询参数 在Solr查询中,有许多重要的查询参数,这些参数可以帮助我们更精确地控制搜索行为。 1. **q**: 必填参数,代表查询字符串。它是任何Solr查询的基础,...

    solr-5.2.1.part2.rar 编译 第2部分,共2部分

    3. 用Ant把Solr源码转换为MyEclipse Web项目 进入Solr源码的根目录 在cmd中输入ant eclipse, 按回车后你将会看到如下画面, 如果你的c:\Users\用户名\.ant\lib下没有ivy jar包的话 此时你按它说的那样需输入ant ...

    Tomcat+solrcloud6.2整合Web项目

    《Tomcat+SolrCloud6.2整合Web项目详解》 在现代的互联网环境中,高效、精准的全文搜索引擎已经成为各种Web应用不可或缺的一部分。Solr,作为Apache Lucene的一个子项目,以其强大的搜索功能和易扩展性深受开发者...

    solr完全工具包

    Solr还支持复杂的查询语法,包括布尔运算符、通配符、范围查询、高亮显示等,这使得搜索功能更加灵活和强大。 总之,Solr完全工具包为Linux环境下的Solr部署提供了必要的资源,包括Solr服务器、分词器以及数据处理...

    solr4.10.2与tomcat6的整合

    ### Solr 4.10.2 与 Tomcat 6 的整合详解 #### 一、Solr 与 Tomcat 整合概述 Solr 是一个高性能、采用 Java 开发的全文搜索引擎,常用于网站搜索功能的搭建。而 Apache Tomcat 是一个免费开源的 Servlet 容器,...

Global site tag (gtag.js) - Google Analytics