java - Solr DataImport 从数据库读取数据时出错(MySQL)

标签 java mysql ubuntu solr jetty

我已经安装了 Solr 以及 DataImport 处理程序/插件...经过反复试验,我能够让 Solr 连接到数据库。

不幸的是,我不懂 Java,下面的错误响应难倒了我...

 {
   "responseHeader": {
   "status": 0,
   "QTime": 2682
 },
   "initArgs": [
   "defaults",
  [
  "config",
  "data-config.xml"
  ]
],
"command": "full-import",
"mode": "debug",
"documents": [],
"verbose-output": [
  "entity:product",
  [
  "document#1",
   [
    "query",
     "SELECT A.product_attribute_id, A.product_id, A.model, A.sku_code, A.status, A.image_filename, A.local_filename, A.width, A.width_final, A.length, A.length_final, A.msrp, A.map_price, A.sku_upc_code, A.url, A.discontinued, A.sq_foot, A.weight, A.rolled_length, A.rolled_width, A.rolled_height, A.lifestyle, A.detailed_color, A.bullet_point1, A.bullet_point2, A.bullet_point3, A.on_hand, A.eta_date, A.pile_height, A.eta_quantity, DATE_FORMAT(FROM_UNIXTIME(A.last_updated), '%e %b %Y') AS last_updated, P.sku_description, P.url as product_url, P.design, C.collection_id, C.collection_name, C.url as collection_url, M.manufacturer_name, M.url as manufacturer_url, O.origin_name, T.type_name, CO.content_name, S.style_name, COL.color_name, COL.color_id, PS.parentstyle_name, PC.parentcolor_name, SHA.shape_name, SA.sale_amount, DATE_FORMAT(FROM_UNIXTIME(SA.sale_start), '%e %b %Y') AS sale_start, DATE_FORMAT(FROM_UNIXTIME(SA.sale_end), '%e %b %Y') AS sale_end FROM tr_product_attributes as A INNER JOIN tr_products as P ON A.product_id = P.product_id INNER JOIN tr_collections as C ON P.collection = C.collection_id INNER JOIN tr_manufacturers as M ON P.manufacturer = M.manufacturer_id INNER JOIN tr_origins as O ON P.origin = O.origin_id INNER JOIN tr_types as T ON P.type = T.type_id INNER JOIN tr_contents as CO ON P.content = CO.content_id INNER JOIN tr_styles as S ON A.style = S.style_id INNER JOIN tr_parentstyles as PS ON A.parentstyle = PS.parentstyle_id INNER JOIN tr_colors as COL ON A.color = COL.color_id INNER JOIN tr_parentcolors as PC ON A.parentcolor = PC.parentcolor_id INNER JOIN tr_shapes as SHA ON A.shape = SHA.shape_id LEFT JOIN tr_sales as SA ON P.collection = SA.sale_collection_id WHERE A.status=1 AND A.url NOT LIKE '%http://www.XXXXXXX.com/rugs/rug/-///%' AND PC.parentcolor_name!='NA' AND A.active='Y' AND A.discontinued=0 AND A.local_filename LIKE '%jpg%' AND P.status=1 AND P.discontinued=0 AND C.status=1 AND C.discontinued=0 AND M.status=1",
    "time-taken",
    "0:0:2.652",
    "EXCEPTION",
    "org.apache.solr.handler.dataimport.DataImportHandlerException: Error reading data from database Processing Document # 1\n\tat org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:70)\n\tat org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.getARow(JdbcDataSource.java:398)\n\tat org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.access$600(JdbcDataSource.java:296)\n\tat org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator$1.next(JdbcDataSource.java:336)\n\tat org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator$1.next(JdbcDataSource.java:328)\n\tat org.apache.solr.handler.dataimport.EntityProcessorBase.getNext(EntityProcessorBase.java:133)\n\tat org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:74)\n\tat org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:243)\n\tat org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:475)\n\tat org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:414)\n\tat org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:329)\n\tat org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)\n\tat org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416)\n\tat org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:480)\n\tat org.apache.solr.handler.dataimport.DataImportHandler.handleRequestBody(DataImportHandler.java:185)\n\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)\n\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2064)\n\tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:654)\n\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:450)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:227)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:196)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:497)\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\n\tat java.lang.Thread.run(Thread.java:745)\nCaused by: java.sql.SQLException: Value '\u000535298\u000541486\u0010SE30 Gingerlilly\rSE30R024X036S\u00011E/img/RugImages/Vendors/Colonial Mills/Generation/SE30-gingerlilyl.jpg\u0014SE30-gingerlilyl.jpg\u00052.000\u00052' 0\"\u00053.000\u00053' 0\"\b119.0000\u000789.0000\f082262203658Zhttp://www.XXXXXXX.com/rugs/rug/colonial-mills-generation-seascape/gingerlilly/41486/35298\u00010\u00010\u00013\u00010\u00014\u00014\u0000\u0000\u0000\u0000\u0000\u00010\n0000-00-00\u00010\u00010\n1 Jan 1970\u0004NULLMhttp://www.XXXXXXX.com/rugs/rug/colonial-mills-generation-seascape-se30/41486\bSeascape\u0003347\u0013Generation-SeascapeOhttp://www.XXXXXXX.com/rugs/brands/colonial-mills/collection/generationseascape\u000eColonial Mills1http://www.XXXXXXX.com/rugs/brands/colonial-mills\u0003USA\u0007Braided\rPolypropylene\u0007Braided\u000bGingerlilly\u0003626\fTransitional\fGold, Yellow\tRectangle���\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000' can not be represented as java.sql.Date\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:937)\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:872)\n\tat com.mysql.jdbc.ResultSetRow.getDateFast(ResultSetRow.java:145)\n\tat com.mysql.jdbc.BufferRow.getDateFast(BufferRow.java:689)\n\tat com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2012)\n\tat com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:1975)\n\tat com.mysql.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:4587)\n\tat com.mysql.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:4710)\n\tat org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.getARow(JdbcDataSource.java:358)\n\t... 39 more\n"
  ]
]
],
"status": "idle",
"importResponse": "",
"statusMessages": {
"Time Elapsed": "0:0:2.667",
"Total Requests made to DataSource": "1",
"Total Rows Fetched": "0",
"Total Documents Processed": "0",
"Total Documents Skipped": "0",
"Full Dump Started": "2015-10-21 14:05:52",
"Full Import failed": "2015-10-21 14:05:55"
}
}

我想我已经将范围缩小到错误消息的这个特定部分...

 Caused by: java.sql.SQLException: Value '\u000535298\u000541486\u0010SE30 Gingerlilly\rSE30R024X036S\u00011E/img/RugImages/Vendors/Colonial Mills/Generation/SE30-gingerlilyl.jpg\u0014SE30-gingerlilyl.jpg\u00052.000\u00052' 0\"\u00053.000\u00053' 0\"\b119.0000\u000789.0000\f082262203658Zhttp://www.XXXXXXX.com/rugs/rug/colonial-mills-generation-seascape/gingerlilly/41486/35298\u00010\u00010\u00013\u00010\u00014\u00014\u0000\u0000\u0000\u0000\u0000\u00010\n0000-00-00\u00010\u00010\n1 Jan 1970\u0004NULLMhttp://www.XXXXXXX.com/rugs/rug/colonial-mills-generation-seascape-se30/41486\bSeascape\u0003347\u0013Generation-SeascapeOhttp://www.XXXXXXX.com/rugs/brands/colonial-mills/collection/generationseascape\u000eColonial Mills1http://www.XXXXXXX.com/rugs/brands/colonial-mills\u0003USA\u0007Braided\rPolypropylene\u0007Braided\u000bGingerlilly\u0003626\fTransitional\fGold, Yellow\tRectangle���\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000' can not be represented as java.sql.Date

唯一的问题是这组数据中没有“日期”字段。我有一些“时间戳”字段,但是当我为 Solr 编写配置文件时,我将这些字段表示为数字或整数……或类似的东西。不是日期字段。此外,我暂时将“时间戳”字段调整为 VARCHAR 255,只是想看看这是否会有所作为,但事实并非如此。

非常感谢任何帮助!

最佳答案

您可能在 solr 映射中有一些错误。该错误表示它希望将从数据库读取的“blah blah Gingerlilly blah”值转换为日期,但失败了。

如果您能够在 select 的输出中找到包含“Gingerlilly”内容的列,您将对要检查的配置有一个很好的指示。

关于java - Solr DataImport 从数据库读取数据时出错(MySQL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33261915/

相关文章:

java - java中迭代列表的各种方法的性能评估

java - Android 应用程序上的 SQLite 错误

java - 如果字符串以分号结尾,则从字符串中删除分号

php - 生成的 CSV 下载为空但有内容

linux - dpkg :- error processing package javascript-common (--configure):- while using apt-get command

c - gcc 不会编译为共享文件夹中的可执行文件

java 并发 - 指令级并行(ILP)是否在底层使用

mysql - 使用递归 MySQL 查询从父行到子行获取值

mysql - 根据给定数组的顺序对选定的键进行排序

linux - Docker 命令无法连接到 Docker 守护进程