Unable to find driver class via URLClassLoader in given driver jars: com.mysql.jdbc.Driver and com.

Unable to find driver class via URLClassLoader in given driver jars: com.mysql.jdbc.Driver and com.mysql.jdbc.Driver

配置详情

input{

        stdin{
        }
        jdbc{
			jdbc_driver_library => "mysql-connector-java-5.1.48-bin.jar"
			jdbc_driver_class => "com.mysql.jdbc.Driver"
			jdbc_connection_string => "jdbc:mysql://localhost:3306/rulian"
			jdbc_user => "root"
			jdbc_password => "root"                
			jdbc_paging_enabled => "true"
			jdbc_page_size => "50000"
			codec => plain { charset => "UTF-8"}
			statement => "SELECT id,code,create_time,eff_start_time,eff_stop_time,ip,mark,remark,update_time FROM base_ip where update_time > :sql_last_value"
			clean_run => false
			use_column_value => false
			schedule => "* * * * *"
			type => "jdbc"
        }

}
output{
        stdout{
                codec => json_lines
        }
        elasticsearch{
                hosts => ["http://localhost:9200"]
                index => "base_ip"
                document_id => "%{id}"
        }
}

问题描述

{ 2016 rufus-scheduler intercepted an error:
2016 job:
2016 Rufus::Scheduler::CronJob “* * * * *” {}
2016 error:
2016 2016
2016 LogStash::PluginLoadingError
2016 Unable to find driver class via URLClassLoader in given driver jars: com.mysql.jdbc.Driver and com.mysql.jdbc.Driver
2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/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' 2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.16/lib/logstash/plugin_mixins/jdbc/jdbc.rb:253:inexecute_statement’
2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.16/lib/logstash/inputs/jdbc.rb:309:in execute_query' 2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.16/lib/logstash/inputs/jdbc.rb:276:inblock in run’
2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:234:in do_call' 2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:258:indo_trigger’
2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:300:in block in start_work_thread' 2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:299:inblock in start_work_thread’
2016 org/jruby/RubyKernel.java:1425:in loop' 2016 C:/Users/dxm/Documents/software/elk/logstash-7.4.2/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:289:inblock in start_work_thread’
2016 tz:
2016 ENV[‘TZ’]:
2016 Time.now: 2019-11-06 12:10:27 +0800
2016 scheduler:
2016 object_id: 2012
2016 opts:
2016 {:max_work_threads=>1}
2016 frequency: 0.3
2016 scheduler_lock: #Rufus::Scheduler::NullLock:0x3547c804
2016 trigger_lock: #Rufus::Scheduler::NullLock:0x513c9604
2016 uptime: 136.492 (2m16s492)
2016 down?: false
2016 threads: 2
2016 thread: #Thread:0x2e6582f4
2016 thread_key: rufus_scheduler_2012
2016 work_threads: 1
2016 active: 1
2016 vacant: 0
2016 max_work_threads: 1
2016 mutexes: {}
2016 jobs: 1
2016 at_jobs: 0
2016 in_jobs: 0
2016 every_jobs: 0
2016 interval_jobs: 0
2016 cron_jobs: 1
2016 running_jobs: 1
2016 work_queue: 0

尝试的方法

尝试过很多办法,比如:换驱动器版本号、换JDK版本等措施,折腾了1.5天,结果是都不行。

最终解决方法

将驱动器即mysql-connector-java-5.1.48-bin.jar拷贝到 logstash目录\logstash-core\lib\jars 下,上述问题就可解决。

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值