logstash-plugins / logstash-input-jdbc

Logstash Plugin for JDBC Inputs
Apache License 2.0
449 stars 187 forks source link

Oracle: Unable to find driver class via URLClassLoader #355

Closed lukasertl closed 5 years ago

lukasertl commented 5 years ago
    jdbc {
        jdbc_validate_connection => true
        jdbc_connection_string   => "CONN"
        jdbc_user                => "USER"
        jdbc_password            => "PW"
        jdbc_driver_library      => "/usr/lib64/oracle/19.3/client64/lib/ojdbc8.jar"
        jdbc_driver_class        => "Java::oracle.jdbc.driver.OracleDriver"
        statement                => "select ..."
        schedule                 => "* * * * *"
        last_run_metadata_path   => "/opt/logstash/jdbc_metadata/xxx"
        id                       => "input-jdbc-xxx"
        add_field                => { "database" => "xxx" }
    }

I've dozens of JDBC inputs like the above - all stopped working after upgrade to logstash 7.4.1 (worked fine in 7.4.0). The Oracle driver is from Oracle Instantclient 19.3.

This is the error I get:

{ 2020 rufus-scheduler intercepted an error:
2020   job:
2020     Rufus::Scheduler::CronJob "* * * * *" {}
2020   error:
2020     2020
2020     LogStash::PluginLoadingError
2020     Unable to find driver class via URLClassLoader in given driver jars: Java::oracle.jdbc.driver.OracleDriver and Java::oracle.jdbc.driver.OracleDriver
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.16/lib/logstash/plugin_mixins/jdbc/jdbc.rb:181:in `open_jdbc_connection'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.16/lib/logstash/plugin_mixins/jdbc/jdbc.rb:253:in `execute_statement'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.16/lib/logstash/inputs/jdbc.rb:309:in `execute_query'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.16/lib/logstash/inputs/jdbc.rb:276:in `block in run'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:234:in `do_call'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:258:in `do_trigger'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:300:in `block in start_work_thread'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:299:in `block in start_work_thread'
2020       org/jruby/RubyKernel.java:1425:in `loop'
2020       /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:289:in `block in start_work_thread'
2020   tz:
2020     ENV['TZ']:
2020     Time.now: 2019-10-24 16:12:00 +0200
2020   scheduler:
2020     object_id: 2014
2020     opts:
2020       {:max_work_threads=>1}
2020       frequency: 0.3
2020       scheduler_lock: #<Rufus::Scheduler::NullLock:0x3d368650>
2020       trigger_lock: #<Rufus::Scheduler::NullLock:0x7e02936c>
2020     uptime: 9.879249 (9s881)

2020     down?: false
2020     threads: 2
2020       thread: #<Thread:0x3e65047c>
2020       thread_key: rufus_scheduler_2014
2020       work_threads: 1
2020         active: 1
2020         vacant: 0
2020         max_work_threads: 1
2020       mutexes: {}
2020     jobs: 1
2020       at_jobs: 0
2020       in_jobs: 0
2020       every_jobs: 0
2020       interval_jobs: 0
2020       cron_jobs: 1
2020     running_jobs: 1
2020     work_queue: 0
} 2020 .
robbavey commented 5 years ago

This was fixed by #355 and should be fixed by the 4.3.18 release of the jdbc input

wargamez commented 5 years ago

When will that be released?

seanmbowen commented 4 years ago

I am facing this issue in 7.4.2. When will the fix be deployed?

wargamez commented 4 years ago

Still an issue with 7.5.0, actually it has not worked since docker.elastic.co/logstash/logstash:7.1.1 I'm using jdbc/ojdbc8-19.3.jar and RUN bin/logstash-plugin install logstash-input-jdbc in my Dockerfile. Any idea as to when this fix will make it into the official download plugin repo/url as shown above in the Dockerfile RUN statement?

jsvd commented 4 years ago

for those hitting this issue, running bin/logstash-plugin update logstash-input-jdbc should get you to 4.3.19 (this fix landed in 4.3.18):

/tmp/logstash-7.5.0
❯ bin/logstash-plugin update logstash-input-jdbc
Updating logstash-input-jdbc
Updated logstash-input-jdbc 4.3.16 to 4.3.19

Version >=4.3.19 will be shipped in 7.5.1