Defining as a "long" or "int" type throws an error on startup
solr启动时候,报如下异常:
[java] view plaincopy
- SEVERE: org.apache.solr.common.SolrException
- at org.apache.solr.core.SolrCore.<init>(SolrCore.java:600)
- at org.apache.solr.core.CoreContainer.create(CoreContainer.java:480)
- at org.apache.solr.core.CoreContainer.load(CoreContainer.java:332)
- at org.apache.solr.core.CoreContainer.load(CoreContainer.java:216)
- at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
- at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
- at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
- at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
- at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
- at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
- at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
- at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
- at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
- at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
- at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
- at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
- at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
- at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
- at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
- at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
- at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
- at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
- at org.apache.catalina.core.StandardService.start(StandardService.java:516)
- at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
- at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
- at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
- Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.
- at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:202)
- at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:527)
- at org.apache.solr.core.SolrCore.<init>(SolrCore.java:594)
- ... 32 more
- Caused by: java.lang.NumberFormatException: For input string: "MA147LL/A"
- at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
- at java.lang.Integer.parseInt(Integer.java:449)
- at java.lang.Integer.parseInt(Integer.java:499)
- at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:291)
- at org.apache.solr.handler.component.QueryElevationComponent$ElevationObj.<init>(QueryElevationComponent.java:119)
- at org.apache.solr.handler.component.QueryElevationComponent.loadElevationMap(QueryElevationComponent.java:264)
- at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:186)
- ... 34 more
我的solr版本是3.6.1。
通过查看异常堆栈 :Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.和Caused by: java.lang.NumberFormatException: For input string: "MA147LL/A"
问题定位在初始化QueryElevationComponent组件时失败。在solrconfig.xml文件中找到QueryElevationComponent的配置项:
[java] view plaincopy
- <searchComponent name="elevator" class="solr.QueryElevationComponent">
- <!-- pick a fieldType to analyze queries -->
- <str name="queryFieldType">string</str>
- <str name="config-file">elevate.xml</str>
- </searchComponent>
- <!--
- A request handler for demonstrating the elevator component
- -->
- <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
- <lst name="defaults">
- <str name="echoParams">explicit</str>
- <str name="df">text</str>
- </lst>
- <arr name="last-components">
- <str>elevator</str>
- </arr>
- </requestHandler>
从配置文件得知在初始化QueryElevationComponent的时候会去加载conf目录下的elevate.xml文件,所以打开elevate.xml文件看看:
[java] view plaincopy
- <elevate>
- <query text="foo bar">
- <doc id="1" />
- <doc id="2" />
- <doc id="3" />
- </query>
- <query text="ipod">
- <doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
- <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
- </query>
- </elevate>
你会发现有一个id="MA147LL/A"和id="IW-02"的配置项,问题就在于id的值为"MA147LL/A"和IW-02,它是string类型,当我们把所<uniqueKey> id 定义为long或int等number类型时,自然会报以上异常。
这是一个solr的bug:https://issues.apache.org/jira/browse/SOLR-2997
有两种解决方案:
(一)将id="MA147LL/A" 改为id="1",将id="IW-02"改为id="2",将其值设为整形。
(一)在solrconfig.xml文件中注释掉以下代码:(QueryElevationComponent组件对于初学者一般上不用,所以可以先注释掉)
[java] view plaincopy
- <searchComponent name="elevator" class="solr.QueryElevationComponent">
- <!-- pick a fieldType to analyze queries -->
- <str name="queryFieldType">string</str>
- <str name="config-file">elevate.xml</str>
- </searchComponent>
- <!--
- A request handler for demonstrating the elevator component
- -->
- <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
- <lst name="defaults">
- <str name="echoParams">explicit</str>
- <str name="df">text</str>
- </lst>
- <arr name="last-components">
- <str>elevator</str>
- </arr>
- </requestHandler>
PS: QueryElevationComponent组件用于solr实现竞价排名,接下来会写一篇关于solr竞价排名的文章。
Defining as a "long" or "int" type throws an error on startup的更多相关文章
- Could not autowire. No beans of 'int' type found. less... (Ctrl+F1) Checks autowiring problems in a bean class.
package com.cxy.netty.controller; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel ...
- [Creating an image format with an unknown type is an error] on cordova, ios 10
在 iOS 10 调用 了 获取 相册的 可编辑 的 照片后,会出现 [Creating an image format with an unknown type is an error] 这个 ...
- BAPI_ACC_DOCUMENT_POST Enter rate / GBP rate type M for Error SG105
Folks, I was wondering if I could get a bit of help here as I've been racking my brains on it for ag ...
- "Type Coercion failed" Error in FlashBuilder 4.7
作者:Panda Fang 出处:http://www.cnblogs.com/lonkiss/p/3544450.html 原创文章,转载请注明作者和出处,未经允许不可用于商业营利活动 做robot ...
- task:scheduled cron 合法
http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html task:scheduled o ...
- [转]Java常用工具类集合
转自:http://blog.csdn.net/justdb/article/details/8653166 数据库连接工具类——仅仅获得连接对象 ConnDB.java package com.ut ...
- 1.4 Service
用于在后台完成用户指定的操作,为其他组件提供后台服务或监控其他组件的运行状态. 开发人员需要在应用程序配置文件中声明全部的service,使用<service></service&g ...
- 自动扫描FTP文件工具类 ScanFtp.java
package com.util; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import ja ...
- RSA加密解密操作
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
随机推荐
- jquery刷新iframe页面的方法
1,reload 方法,该方法强迫浏览器刷新当前页面. 语法:location.reload([bForceGet]) 参数: bForceGet, 可选参数, 默认为 false,从客户端缓存里取当 ...
- PHP关闭Notice错误提示
原文出处 本文章介绍在php中关闭notice错误的一些做法,但是不得不说的是在关掉错误提示时,那么程序代码中大量的notice级别错误是否会造成PHP性能下降 PHP Notice: Undefin ...
- 面向报文(UDP)和面向字节流(TCP)的区别
转载:http://blog.csdn.net/wanghaobo920/article/details/11877589 面向报文(UDP)和面向字节流(TCP)的区别 面向报文的传输方式是应用层交 ...
- jquery ajax跨域取数据
jsonp.js/html 主要是利用jquery ajax和jsonp的datatype 跨站点请求数据,记录~ 同源策略:同端口,同协议,同域:所以ajax不能支持跨域取得数据,解决方案一般是js ...
- Object To Enum
public static T ObjectToEnum<T>(object o) { try { return (T)Enum.Parse(typeof(T), o.ToString() ...
- Android 点击事件,4种回调。
1. 继承监听接口. 2. xml方式 : 设置 android:onClick 3. 内部类 4. 匿名类 ------------------------------------------- ...
- cocos2dx 实现不一样的ScrollView
原来在公司被迫加班加点赶工,用lua实现的版本:http://www.cnblogs.com/mmc1206x/p/4146911.html 后来因我个人的需要, 用C++实现了一个版本. 蓦然回首, ...
- [lua]再版jobSchedule与脚本描述范型
首先贴上代码 -- CPM:关键路径法(Critical Path Method) jobSchedule = { todos = { -- todo list ... ["finale&q ...
- Leetcode系列-Search in Rotated Sorted Array
做Leetcode题有一段时间了,但都是断断续续的,到现在才做了30题左右,感觉对自己来说还是有点难度的.希望自己能继续坚持下去,在校招前能解决超过一百题吧. 其实这些题就是用来训练你的解题思路的,做 ...
- freeswitch 拨号时添加自定义变量
Using Channel Variables in Dialplan Condition Statements Channel variables can be used in conditions ...