theangryangel / logstash-output-jdbc

JDBC output for Logstash
MIT License
256 stars 101 forks source link

:error=>"missing class name (`com.zaxxer.hikari.HikariDataSource')" #146

Closed dslove closed 5 years ago

dslove commented 5 years ago

Hi,

I am trying this plugin. I clone it (master, 5.4.0) to IntelliJ, set the SDK to JRuby, bundle, and then build the gem. I then install it on my local Logstash (6.6.1), trying to dump data to MySQL (8.0.15), and I can see it is installed without any problem. Then I try to run my conf file and hit this problem. It is on Mac.

The conf file output section is like this: output { jdbc { driver_jar_path => "/Users/user/Downloads/mysql-connector-java-5.1.47-bin.jar" connection_string => "jdbc:mysql://localhost:3306/logstash_dump" username => "root" password => "passw0rd" statement => [ "INSERT INTO transformed_vid_tags (id, search_id, label, full_label) VALUE (?, ?, ?, ?);", "id", "search_id", "label", "full_label" ] } }

The full error message is this: [2019-03-14T14:20:33,172][ERROR][logstash.pipeline ] Error registering plugin {:pipeline_id=>"main", :plugin=>"#", :error=>"missing class name (`com.zaxxer.hikari.HikariDataSource')", :thread=>"#"}

In gemspec, there is: s.requirements << "jar 'com.zaxxer:HikariCP', '2.7.2'"

It seems the error is related to trying to execute this statement in jdbc.rb @pool = Java::ComZaxxerHikari::HikariDataSource.new

BTW, I have used Logstash with other plugins without any problems.

I am quite new to Ruby and Gem. Hopefully I can get some helps here. Thanks.

theangryangel commented 5 years ago

Unless you intend to do development, install using the logstash-plugin command instead of cloning and trying to install from source and see if it fixes your problem first please. 9 times out of 10 people installing from source make a mistake.

theangryangel commented 5 years ago

If you are intending to install from source for some reason, it sounds like you’ve missed the rake install_jars command to fetch the jars.

dslove commented 5 years ago

Thank you very much for your replies!

I missed to rake install_jars. After I did it, problem solved!