嗨,我想为我的 MSSQL 2008 R2 服务器写一条河。我已将 MSSQL 驱动程序和 jdbc jar 复制到 bin/plugins/jdbc 目录中。我已经在 Solr 中测试了 MSSQL 驱动程序,它工作正常。所以连接字符串是正确的。
当我启动 ES 服务器时,我得到了这个异常:
org.elasticsearch.common.settings.NoClassSettingsException: Failed to load class with value [jdbc]
at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:87)
at org.elasticsearch.river.RiverModule.spawnModules(RiverModule.java:58)
at org.elasticsearch.common.inject.ModulesBuilder.add(ModulesBuilder.java:44)
at org.elasticsearch.river.RiversService.createRiver(RiversService.java:135)
at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)
at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)
at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:93)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: jdbc
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:73)
... 9 more
我的卷曲看起来像这样:
curl -XPUT http://localhost:9200/_river/documents/_meta -d '
{
"type" : "jdbc",
"jdbc" : {
"driver" : "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"url" : "jdbc:sqlserver://CPCDKD3;databaseName=Sampledocs",
"user" : "XXXX",
"password" : "XXXX",
"sql" : "SELECT * from Docs"
},
"index" : {
"index" : "documents",
"type" : "FieldId",
"type" : "FieldTitle",
"type" : "FieldCOntent"
}
}'