jprante / elasticsearch-jdbc

JDBC importer for Elasticsearch
Apache License 2.0
2.84k stars 709 forks source link

Problems :( - NoClassSettingsException[Failed to load class with value [jdbc]] #391

Open xyhp915 opened 9 years ago

xyhp915 commented 9 years ago

Results :1234:

{
  "_index": "_river",
  "_type": "my_jdbc_river2",
  "_id": "_status",
  "_version": 1,
  "_score": 1,
  "_source": {
    "error": "NoClassSettingsException[Failed to load class with value [jdbc]]; nested: ClassNotFoundException[jdbc]; ",
    "node": {
      "id": "APUJ0gByQb62XhVRUx3b2Q",
      "name": "Boomer",
      "transport_address": "inet[/x.x.x.x:9300]"
    }
  }
}

Console logs :1234:

jvm 1    | [2014-11-20 20:41:46,791][WARN ][river                    ] [Boomer] failed to create river [jdbc][my_jdbc_river]
jvm 1    | org.elasticsearch.common.settings.NoClassSettingsException: Failed to load class with value [jdbc]
jvm 1    |  at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:87)
jvm 1    |  at org.elasticsearch.river.RiverModule.spawnModules(RiverModule.java:58)
jvm 1    |  at org.elasticsearch.common.inject.ModulesBuilder.add(ModulesBuilder.java:44)
jvm 1    |  at org.elasticsearch.river.RiversService.createRiver(RiversService.java:137)
jvm 1    |  at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:275)
jvm 1    |  at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:269)
jvm 1    |  at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:113)
jvm 1    |  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
jvm 1    |  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
jvm 1    |  at java.lang.Thread.run(Thread.java:745)
jvm 1    | Caused by: java.lang.ClassNotFoundException: jdbc
jvm 1    |  at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
jvm 1    |  at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
jvm 1    |  at java.security.AccessController.doPrivileged(Native Method)
jvm 1    |  at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
jvm 1    |  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
jvm 1    |  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
jvm 1    |  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
jvm 1    |  at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:73)
jvm 1    |  ... 9 more

My elasticsearch version is 1.4.0 Beta . Plugins jdbc dir ...

-rw-rw-r--  1 root root  283418 Nov 20 20:12 elasticsearch-river-jdbc-1.4.0.3.Beta1.jar
-rw-rw-r--  1 root root  959987 Nov 20 20:34 mysql-connector-java-5.1.33-bin.jar
-rw-rw-r--  1 root root 4120307 Nov 20 20:32 mysql-connector-java-5.1.33.zip

What should i do ?

jprante commented 9 years ago

Do not run Elasticsearch as root.

Your creation command for the river was wrong.

xyhp915 commented 9 years ago

plugins/jdbc directory permissions problem . Thanks . it solved :) .

ashusheva commented 9 years ago

Hi, I am getting the same error on Windows. Can someone help?

tech-lipi commented 9 years ago

Running below command to create river using sense plugin :

PUT _river/my_jdbc_river/_meta { "type":"jdbc", "jdbc": { "driver":"com.microsoft.sqlserver.jdbc.SQLServerDriver", "url":"jdbc:sqlserver://localhost:1433;databaseName=DB_Name", "user":"user", "password":"password", "sql":"select id, name from user" } }

It creates river successfully and shows message in river :

{ "_index": "_river", "_type": "my_jdbc_river", "_id": "_meta", "_version": 1, "created": true }

but gives below error in command prompt :

[2015-06-19 13:06:26,813][WARN ][river ] [Mark Gervaisnight Shade] failed to create river [jdbc][my_jdbc_river] 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:138) at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:274) at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:268) at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:113) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: jdbc at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:73)

Using

ElasticSearch version 1.6 elasticsearch-jdbc-1.6.0.0-uberjar Java8 sqljdbc4

Is it about permission issue in Windows as well? Please help.

adnangul commented 9 years ago

ashishgupta4486, I'm getting same. was you able to resolve the issue? I've installed 'elasticsearch-jdbc' as plugin

tech-lipi commented 9 years ago

@adnangul

Yes, the problem was with version. On site its written version should be same for ES and river but it does not work in all scenarios. For me below are the combination of versions worked -

sqljdbc 4 elasticsearch 1.5.2 elasticsearch-river-jdbc 1.4.0.10

jprante commented 9 years ago

Please check your command line tool. It does not send the JSON body in correct syntax to Elasticsearch. Watch out for escaping quotes (").

adnangul commented 9 years ago

@ashishgupta4486 I'm using elastic 1.6.0 elasticsearch-jdbc 1.6.0.0 As per site they should be compatible

@jprante I've installed the plugin using below command

plugin -u http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/1.6.0.0/elasticsearch-jdbc-1.6.0.0-dist.zip -i jprante/elasticsearch-jdbc

I'm using curl to create river/index as below

curl -XPUT localhost:9200/_river/product/_meta -d @curl-data.txt

The data in file: { "type": "jdbc", "jdbc": { "url": "jdbc:mysql://localhost:3306/test", "user": "user", "password": "pass", "sql": "SELECT * FROM product", "index": "example", "type": "product" } }

I've double check the quotes seems good. Please advice in case you notice any issues with steps above

jprante commented 9 years ago

With curl, you need to add the --data-binary flag to send data to Elasticsearch.

jprante commented 9 years ago

Most important: you installed a river. JDBC importer 1.6.0.0 is no longer a river.

tech-lipi commented 9 years ago

@adnangul

Its not gonna work with 1.6 version since its depricated. I also tried for the same struggled for few hours then found a blog https://www.elastic.co/blog/deprecating-rivers.

Then I tried with couple of other version and finally worked with below combination

sqljdbc 4 elasticsearch 1.5.2 elasticsearch-river-jdbc 1.4.0.10

For a version 1.6 I am not sure with curl.

adnangul commented 9 years ago

That's mean it wouldn't work even if I use --data-binary as below curl -XPUT localhost:9200/_river/product/_meta --data-binary @curl-data.txt

Adnan

On Thu, Jul 2, 2015 at 4:45 PM, Jörg Prante notifications@github.com wrote:

Most important: you installed a river. JDBC importer 1.6.0.0 is no longer a river.

— Reply to this email directly or view it on GitHub https://github.com/jprante/elasticsearch-jdbc/issues/391#issuecomment-118177531 .

Regards, Adnan Yaqoob

adnangul commented 9 years ago

@ashishgupta4486 Deprecating shouldn't stop functionality; it's an indicator that the feature will be removed in future version. As per link you shared, probably they are going to keep the infrastructure up to 2.0. Will be removed in 2.0 onwards

Adnan

jprante commented 9 years ago

The pain with river was so great I dropped support for river API as soon as possible.

For ES 1.6 upwards, I do no longer offer JDBC river versions, only JDBC importer, with improved runtime behavior.

tech-lipi commented 9 years ago

@adnangul

Yes you are right. Its always to have alternate if something is depricated since its gonna remove in future as you said. Better you change 1.6 if you want to use river.

poonaminfor commented 9 years ago

Hi All, I am getting the same error: I am using: elastic 1.6.0 elasticsearch-jdbc 1.6.0.0 (importer).

and my request in marverl sense is: PUT http://localhost:9200/_river/orders_river/_meta { "type":"jdbc", "jdbc": { "driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver", "url":"jdbc:sqlserver://usalvwaldbqa1:1433;databaseName=es", "user":"es", "password":"Answ3r21", "sql":"SELECT * FROM es.g_solution where solution_id=45", "index" : "clients", "type" : "orders"
} }

poonaminfor commented 9 years ago

for elastic 1.6 which version of jdbc(river or importer) i should go for?or should i be using belowcombinations only? sqljdbc 4 elasticsearch 1.5.2 elasticsearch-river-jdbc 1.4.0.10

tech-lipi commented 9 years ago

You have to work with importer in case of 1.6.

Below combination worked for me so I shared. I tried with 1.6 for ES and river both but didn't work and I am not sure about importer. Didn't try yet.

poonaminfor commented 9 years ago

Thanks Ashish! i used importer version itself but did not work for me. elastic 1.6.0 elasticsearch-jdbc 1.6.0.0 (importer)

poonaminfor commented 9 years ago

and sqljdbc 4.

tech-lipi commented 9 years ago

@poonaminfor Haven't tried importer yet. @jprante can actually help you in this.

Meanwhile you can use combination which I shared above for _river. For that I am sure.

poonaminfor commented 9 years ago

Thanks Ashish,will try with ur combination.

poonaminfor commented 9 years ago

I could fix it with ur combination Ashish but running into another issue:

2015-07-08 04:30:51,817][ERROR][bootstrap ] [nodedev] Exception org.elasticsearch.ElasticsearchIllegalStateException: Can't move to started state when closed at org.elasticsearch.common.component.Lifecycle.canMoveToStarted(Lifecycle.java:117) at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:79) at org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:258) at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:128) at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:216) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32) [2015-07-08 04:30:53,172][WARN ][common.jna ] unable to link C library. native methods (mlockall) will be disabled. [2015-07-08 04:30:53,451][INFO ][node ] [nodedev] version[1.5.2], pid[11556], build[62ff986/2015-04-27T09:21:06Z]

poonaminfor commented 9 years ago

i am using windows 2008 r2 and its a virtual machine,

poonaminfor commented 9 years ago

I could fix it mlock setting,tnx.

tech-lipi commented 9 years ago

@poonaminfor Check your java version once. I was also getting same issue but using java 8 and combination of above given set up files this problem gone.

jprante commented 9 years ago

Sorry, no fsriver here, and no Logstash. This is JDBC river/importer.