Error when port data from mySQL

I'm a little desperate. I'm trying to index data from a MySQL database.
But it just won't work. Can you tell me what I'm doing wrong?
Elasticsearch and Kibana is running and the MySQL database is available.

Here is my config file:

input {
  jdbc { 
    jdbc_connection_string => "jdbc:mysql://localhost:3306/data_2019"
    # The user we wish to execute our statement as
    jdbc_user => "root"
    jdbc_password => ""
    # The path to our downloaded jdbc driver
    jdbc_driver_library => "/Users/volker/elastic/logstash-6.6.0/mysql-connector-java-8.0.15/mysql-connector-java-8.0.15.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    # our query
    statement => "SELECT * FROM dbo_daten_2019"
    }
  }
output {
  stdout { codec => json_lines }
  elasticsearch {
  "hosts" => "localhost:9200"
  "index" => "test-migrate"
  "document_type" => "data"
  }
}

And here's the error output on the terminal:

Pipeline_id:main
Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"root", jdbc_password=><password>, statement=>"SELECT * FROM dbo_artikeldaten_2019_01_de", jdbc_driver_library=>"/Users/volker/elastic/logstash-6.6.0/mysql-connector-java-8.0.15/mysql-connector-java-8.0.15.jar", jdbc_connection_string=>"jdbc:mysql://127.0.0.1/lightscout_data_2019", id=>"7f33589f3939a34064542ea6f3d0504ef0c23945020652a0b5156c8d319c9b17", jdbc_driver_class=>"com.mysql.jdbc.Driver", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_9f726a29-6efb-47df-9ed6-09107c732ed0", enable_metric=>true, charset=>"UTF-8">, jdbc_paging_enabled=>false, jdbc_page_size=>100000, jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>{"sql_last_value"=>1970-01-01 01:00:00 +0100}, last_run_metadata_path=>"/Users/volker/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>
Error: com.mysql.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
Exception: LogStash::ConfigurationError
Stack: /Users/volker/elastic/logstash-6.6.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:163:in `open_jdbc_connection'
/Users/volker/elastic/logstash-6.6.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:221:in `execute_statement'
/Users/volker/elastic/logstash-6.6.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:277:in `execute_query'
/Users/volker/elastic/logstash-6.6.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:263:in `run'
/Users/volker/elastic/logstash-6.6.0/logstash-core/lib/logstash/pipeline.rb:409:in `inputworker'
/Users/volker/elastic/logstash-6.6.0/logstash-core/lib/logstash/pipeline.rb:403:in `block in start_input'
[2019-02-06T19:00:18,140][ERROR][logstash.inputs.jdbc     ] Failed to load /Users/volker/elastic/logstash-6.6.0/mysql-connector-java-8.0.15/mysql-connector-java-8.0.15.jar {:exception=>#<TypeError: failed to coerce jdk.internal.loader.ClassLoaders$AppClassLoader to java.net.URLClassLoader>}
[2019-02-06T19:00:18,145][ERROR][logstash.pipeline        ] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:main

Are you using Java 9? If so, can you test whether it works with Java 8?

Thanks for your reply. I'm using Java 8. Does it make sense to test it with Java 9?

No, I don't think so, it is just that the only hit I got for the error message "failed to coerce jdk.internal.loader.ClassLoaders$AppClassLoader to java.net.URLClassLoader" was due to a change made in Java 9.

I do not know what is causing this.

Hmm okay.
I have changed the line

jdbc_driver_class => "com.mysql.jdbc.Driver"

to

jdbc_driver_class => "Java::com.mysql.jdbc.Driver"

But that didn't help either. The error message remains the same.
Does anyone have an idea where the mistake might be?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.