Logstash: Error org.postgres.Driver not loaded
<p>I need to get data from a PostgreSQL DB and index it into Elasticsearch. 
<a href="https://www.elastic.co/blog/logstash-jdbc-input-plugin" rel="nofollow">https://www.elastic.co/blog/logstash-jdbc-input-plugin</a></p>

<p>When I run <code>/opt/logstash-2.3.3/bin/logstash -v -f es_table.logstash.conf</code>
<br>I receive the following error:</p>

<pre><code>Pipeline aborted due to error 
{:exception=&gt;#&lt;LogStash::ConfigurationError: org.postgres.Driver not loaded. 
Are you sure you've included the correct jdbc driver in :jdbc_driver_library?&gt;, :backtrace=&gt;["/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-3.0.2/lib/logstash/plugin_mixins/jdbc.rb:156:in `prepare_jdbc_connection'", "/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-3.0.2/lib/logstash/plugin_mixins/jdbc.rb:148:in `prepare_jdbc_connection'", "/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-3.0.2/lib/logstash/inputs/jdbc.rb:167:in `register'", "/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:330:in `start_inputs'", "org/jruby/RubyArray.java:1613:in `each'", "/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:329:in `start_inputs'", "/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:180:in `start_workers'", "/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:136:in `run'", "/opt/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/agent.rb:473:in `start_pipeline'"], :level=&gt;:error}
</code></pre>

<p>Here is a piece of my Logstash configuration:</p>

<pre><code>input {
   jdbc {
      jdbc_user =&gt; 'user'
      jdbc_driver_class =&gt; 'org.postgresql.Driver'
      jdbc_connection_string =&gt; 'jdbc:postgresql://1.1.1.1:5432/db'
      lowercase_column_names =&gt; false
      clean_run =&gt; false
      jdbc_driver_library =&gt; '/usr/share/java/postgresql-jdbc4.jar'
      jdbc_password =&gt; 'pass'
      jdbc_validate_connection =&gt; true
      jdbc_page_size =&gt; 1000
      jdbc_paging_enabled =&gt; true
      statement =&gt; 'SELECT * FROM "table"'
      type =&gt; 'table'
   }
...
</code></pre>

<p>The jdbc4 driver exists. I tried jdbc3 too without success.</p>

<pre><code>ls /usr/share/java | grep postgresql-jdbc
postgresql-jdbc3-9.2.jar
postgresql-jdbc3.jar
postgresql-jdbc4-9.2.jar
postgresql-jdbc4.jar
</code></pre>

<p>The Driver class is inside:</p>

<pre><code>jar tf /usr/share/java/postgresql-jdbc4.jar | grep -i driver
org/postgresql/Driver$1.class
org/postgresql/Driver$ConnectThread.class
org/postgresql/Driver.class
org/postgresql/util/PSQLDriverVersion.class
META-INF/services/java.sql.Driver
</code></pre>

<p>The port 5432 is open:</p>

<pre><code>telnet 192.168.109.108 5432
Trying 192.168.109.108...
Connected to 192.168.109.108.
Escape character is '^]'.
</code></pre>

<p>Authentication to the DB works.</p>