我尝试使用 apache solr-3.1.0 和内置的 Jetty 服务器容器来索引我的 mysql 表我的 data-config.xml 是
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lol"
user="root"
password="n"/>
<document name="content">
<entity name="id">
query="SELECT id from foo"
</entity>
</document>
</dataConfig>
当我跑步时
http://localhost:8983/solr/dataimport?command=full-import
在浏览器上我收到此错误
<response><lst name="responseHeader"><int name="status">0</int><int
name="QTime">0</int></lst><lst name="initArgs"><lst name="defaults"><str
name="config">data-config.xml</str></lst></lst><str name="command">
full-import</str><str name="status">idle</str><str name="importResponse"/>
<lst name="statusMessages"><str name="Time Elapsed">0:0:4.554</str>
<str name="Total Requests made to DataSource">1</str>
<str name="Total Rows Fetched">0</str><str name="Total Documents Processed">0</str>
<str name="Total Documents Skipped">0</str>
<str name="Full Dump Started">2013-06-28 11:17:29</str>
<str name="">Indexing failed. Rolled back all changes.</str>
<str name="Rolledback">2013-06-28 11:17:29</str></lst>
<str name="WARNING">This response format is experimental.
It is likely to change in the future.</str></response>
好心的帮助
并且在查询中我选择了 int 的 id ,我哪里出错了,这是我的 .sql 文件
-- phpMyAdmin SQL Dump
-- version 3.4.11.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 28, 2013 at 11:41 AM
-- Server version: 5.5.31
-- PHP Version: 5.4.6-1ubuntu1.2
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `lol`
--
-- --------------------------------------------------------
--
-- Table structure for table `foo`
--
CREATE TABLE IF NOT EXISTS `foo` (
`id` int(20) NOT NULL,
`koo` varchar(40) NOT NULL,
`ppp` varchar(40) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `foo`
--
INSERT INTO `foo` (`id`, `koo`, `ppp`) VALUES
(1, 'have to do it ', 'lie'),
(2, 'keep quiet', 'kkkk');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
这是日志的一部分
INFO: SolrUpdateServlet.init() done
2013-06-28 11:17:13.719:WARN::failed SocketConnector@0.0.0.0:8983: java.net.BindException: Address already in use
2013-06-28 11:17:13.719:WARN::failed Server@6d5e3a0c: java.net.BindException: Address already in use
2013-06-28 11:17:13.720:WARN::EXCEPTION
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at java.net.ServerSocket.<init>(ServerSocket.java:181)
at org.mortbay.jetty.bio.SocketConnector.newServerSocket(SocketConnector.java:80)
at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:283)
at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.Server.doStart(Server.java:235)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
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:601)
at org.mortbay.start.Main.invokeMain(Main.java:194)
at org.mortbay.start.Main.start(Main.java:534)
at org.mortbay.start.Main.start(Main.java:441)
at org.mortbay.start.Main.main(Main.java:119)