{"action":"closed","issue":{"url":"https://api.github.com/repos/jruby/warbler/issues/186","labels_url":"https://api.github.com/repos/jruby/warbler/issues/186/labels{/name}","comments_url":"https://api.github.com/repos/jruby/warbler/issues/186/comments","events_url":"https://api.github.com/repos/jruby/warbler/issues/186/events","html_url":"https://github.com/jruby/warbler/issues/186","id":18996296,"number":186,"title":"LoadError: load error: META-INF/main -- java.sql.SQLException: No suitable driver found for jdbc:postgresql","user":{"login":"EricLondon","id":1228910,"avatar_url":"https://avatars.githubusercontent.com/u/1228910?v=3","gravatar_id":"","url":"https://api.github.com/users/EricLondon","html_url":"https://github.com/EricLondon","followers_url":"https://api.github.com/users/EricLondon/followers","following_url":"https://api.github.com/users/EricLondon/following{/other_user}","gists_url":"https://api.github.com/users/EricLondon/gists{/gist_id}","starred_url":"https://api.github.com/users/EricLondon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricLondon/subscriptions","organizations_url":"https://api.github.com/users/EricLondon/orgs","repos_url":"https://api.github.com/users/EricLondon/repos","events_url":"https://api.github.com/users/EricLondon/events{/privacy}","received_events_url":"https://api.github.com/users/EricLondon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2013-09-04T19:28:47Z","updated_at":"2015-04-24T13:50:30Z","closed_at":"2015-04-24T13:50:30Z","body":"I am trying to use warble to create a JAR, which happens to use a postgresql driver jar to connect to Amazon RedShift.\r\n\r\nWhen I create the jar and execute, I get the following exception:\r\n\r\n```bash\r\n$ java -jar test.jar\r\nLoadError: load error: META-INF/main -- java.sql.SQLException: No suitable driver found for jdbc:postgresql://MYHOST.redshift.amazonaws.com:MYPORT/MYDB?user=MYUSER&password=MYPASSWORD\r\n  require at org/jruby/RubyKernel.java:1054\r\n  require at jar:file:/var/folders/2w/n_00rw7x0fx8tkx_tgk4kq7m0000gn/T/jruby8811939749765534549extract/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36\r\n   (root) at <script>:3\r\nerror: org.jruby.embed.EvalFailedException: (LoadError) load error: META-INF/main -- java.sql.SQLException: No suitable driver found for jdbc:postgresql://MYHOST.redshift.amazonaws.com:MYPORT/MYDB?user=MYUSER&password=MYPASSWORD\r\n```\r\n\r\nI separated the connectivity code to demonstrate that it works prior to creating the Jar. Current files:\r\n\r\n```bash\r\n$ tree\r\n.\r\n├── Gemfile\r\n├── Gemfile.lock\r\n├── bin\r\n│   └── main.rb -> ../main.rb\r\n├── lib\r\n│   └── postgresql-9.2-1003.jdbc4.jar\r\n├── main.rb\r\n└── test.jar\r\n\r\n2 directories, 6 files\r\n```\r\n\r\nFile contents: main.rb\r\n```ruby\r\n#!/usr/bin/env jruby\r\n\r\nrequire 'rubygems'\r\n\r\n$: << \"./lib\"\r\n\r\nrequire 'postgresql-9.2-1003.jdbc4.jar'\r\n\r\nputs $CLASSPATH\r\n\r\njdbc_url = \"jdbc:postgresql://MYHOST.redshift.amazonaws.com:MYPORT/MYDB?user=MYUSER&password=MYPASSWORD\"\r\n\r\njava_import java.sql.DriverManager\r\nDriverManager.register_driver(org.postgresql.Driver.new)\r\nDriverManager.get_connection(jdbc_url)\r\n\r\nputs \"Done.\"\r\n\r\n```\r\n\r\nExecution output using JRuby (JIT compiled):\r\n```bash\r\n$ ./main.rb\r\n[\"file:/opt/test/./lib/postgresql-9.2-1003.jdbc4.jar\"]\r\nDone.\r\n```\r\n\r\nJar creation:\r\n```bash\r\n$ warble jar\r\nNo executable matching config.jar_name found, using bin/main.rb\r\nrm -f test.jar\r\nCreating test.jar\r\n```\r\n\r\nJar execution:\r\n```bash\r\n$ java -jar test.jar\r\n[\"jar:file:/opt/test/test.jar!/test/lib/postgresql-9.2-1003.jdbc4.jar\"]\r\nLoadError: load error: META-INF/main -- java.sql.SQLException: No suitable driver found for jdbc:postgresql://BLAH\r\n```\r\n\r\nAny thoughts on why this might not be working?\r\nPerhaps related to this? https://github.com/jruby/jruby/wiki/FAQs#why-do-i-get-classnotfoundexception-when-i-call-javalangclassforname-from-ruby\r\n\r\nEnvironment notes:\r\n```bash\r\n$ ruby -v\r\njruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_51-b11-457-11M4509 [darwin-x86_64]\r\n\r\n$ gem list\r\n\r\n*** LOCAL GEMS ***\r\n\r\nactivemodel (4.0.0)\r\nactiverecord (4.0.0)\r\nactiverecord-deprecated_finders (1.0.3)\r\nactiverecord-jdbc-adapter (1.3.0, 1.2.9.1)\r\nactiverecord-jdbcmysql-adapter (1.3.0, 1.2.9)\r\nactivesupport (4.0.0)\r\nansi (1.4.3)\r\narel (4.0.0)\r\natomic (1.1.13 java, 1.1.10 java)\r\naws-sdk (1.16.1, 1.15.0, 1.14.1, 1.11.1)\r\nbouncy-castle-java (1.5.0147)\r\nbuilder (3.2.2, 3.1.4)\r\nbundler (1.3.5)\r\nbundler-unload (1.0.1)\r\nhashr (0.0.22)\r\ni18n (0.6.5, 0.6.4)\r\njdbc-mysql (5.1.25)\r\njruby-jars (1.7.4)\r\njruby-launcher (1.0.19 java, 1.0.18 java)\r\njruby-openssl (0.8.8)\r\njruby-rack (1.1.13.2)\r\njson (1.8.0 java)\r\nmail (2.5.4)\r\nmime-types (1.25, 1.23)\r\nmini_portile (0.5.1)\r\nminitest (5.0.6, 4.7.5)\r\nmulti_json (1.7.9, 1.7.7)\r\nnokogiri (1.6.0 java, 1.5.10 java)\r\npolyglot (0.3.3)\r\nrake (10.1.0)\r\nrest-client (1.6.7)\r\nrubygems-bundler (1.2.2)\r\nrubyzip (1.0.0, 0.9.9)\r\nrvm (1.11.3.8)\r\nthread_safe (0.1.2 java)\r\ntire (0.6.0)\r\ntreetop (1.4.15)\r\ntzinfo (1.0.1, 0.3.37)\r\nuuidtools (2.1.4)\r\nwarbler (1.3.8)\r\n\r\n$ java -version\r\njava version \"1.6.0_51\"\r\nJava(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)\r\nJava HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)\r\n```"}}