Thanks Russell, I’ve posted it there as well now. If you remember the fix then let me know! 

Cheers

On 2 Dec 2015, at 17:27, Russell Jurney <russell.jurney@gmail.com> wrote:

I've seen this before in jruby, but I can't recall the fix. Maybe try the JRuby list if nobody knows?

On Wednesday, December 2, 2015, Josh Harrison <joshharrison@coraxcyber.com> wrote:
Thanks for your help Samarth, unfortunately I’ve still got the same error after these steps, to give the full error: 

NameError: cannot link Java class org.apache.phoenix.jdbc.PhoenixDriver, probable missing dependency: Could not initialize class org.apache.phoenix.jdbc.PhoenixDriver
                                for_name at org/jruby/javasupport/JavaClass.java:1286
                         get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
                             java_import at file:/usr/local/rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:27
                                     map at org/jruby/RubyArray.java:2412
                             java_import at file:/usr/local/rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:22                                  
                                    load at org/jruby/RubyKernel.java:1087
                                  (root) at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:1
                         load_dependency at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240
                                    load at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268
                                    load at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268
                 load_config_initializer at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/engine.rb:652
                              instrument at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166
                 load_config_initializer at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/engine.rb:651
                                    each at org/jruby/RubyArray.java:1613
                                  Engine at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/engine.rb:616
                           instance_exec at org/jruby/RubyBasicObject.java:1562
                                     run at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/initializable.rb:30
                                  Engine at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/engine.rb:615
                        run_initializers at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/initializable.rb:55
                              tsort_each at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:150
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:210
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:219
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:208
                                    each at org/jruby/RubyArray.java:1613
                        tsort_each_child at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/initializable.rb:44
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:203
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:183
                                    each at org/jruby/RubyArray.java:1613
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:182
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:180
                              tsort_each at /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/tsort.rb:148
                        run_initializers at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/initializable.rb:54
                             initialize! at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/application.rb:352
                                 require at org/jruby/RubyKernel.java:1071
                                 require at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274
                         load_dependency at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240
                                 require at /usr/local/rvm/gems/jruby-1.7.19/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274
                                 (root) at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/application.rb:1
                    require_environment! at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/application.rb:328
    require_application_and_environment! at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:142
                                 console at /usr/local/rvm/gems/jruby-1.7.19/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:67
                                 require at org/jruby/RubyKernel.java:1071
                                  (root) at bin/rails:8

Many thanks



On 2 Dec 2015, at 15:47, Samarth Jain <samarth@apache.org> wrote:

Josh,

One step worth trying would be is to register the PhoenixDriver instance and see if that helps. Something like this:

DriverManager.registerDriver(PhoenixDriver.INSTANCE)
Connection con = DriverManager.getConnection("jdbc:phoenix:localhost:2181”)

- Samarth


On Wed, Dec 2, 2015 at 3:41 PM, Josh Harrison <joshharrison@coraxcyber.com> wrote:

Thanks for your help and quick response Russell. This does seemed to have progressed things, however I’m now getting the following error: 

NameError: cannot link Java class org.apache.phoenix.jdbc.PhoenixDriver, probable missing dependency: Could not initialize class org.apache.phoenix.jdbc.PhoenixDriver

Any further ideas? 

Cheers, 
Josh


On 2 Dec 2015, at 11:37, Russell Jurney <russell.jurney@gmail.com> wrote:

This seems like a class path problem. Try specifying the class path to the jar with that class in it via: CLASSPATH=/foo/bar.jar jruby ...

On Wednesday, December 2, 2015, Josh Harrison <joshharrison@coraxcyber.com> wrote:
Hi Guys,

We’re trying to spin up a testing version of Phoenix and integrate it with a Jruby on rails application. I have Phoenix and Hbase successfully installed, configured and talking to each other, but am coming up with a ‘cannot load java class’ error when trying to make the connection to the rails server. I’m running this in standalone mode by the way for testing purposes.

The correct phoenix-server jars in are the classpath for the application.

Any help or guidance you can give on the the connection would be greatly appreciated.

Phoenix:  4.6
HBase:  1.1.2
JRuby: 1.7.19

Error:

NameError: cannot load Java class org.apache.phoenix.jdbc.PhoenixDriver
                                for_name at org/jruby/javasupport/JavaClass.java:1286
                         get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
                             java_import at file:/usr/local/rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:27

______________________________________________________________________________________________

Here’s my jdbc.rb connector:

require 'java'
java_import 'org.apache.phoenix.jdbc.PhoenixDriver'

java_import 'java.sql.Connection'
java_import 'java.sql.DriverManager'
java_import 'java.sql.ResultSet'
java_import 'java.sql.SQLException'
java_import 'java.sql.PreparedStatement'
java_import 'java.sql.Statement'

Java::JavaClass.for_name "org.apache.phoenix.jdbc.PhoenixDriver"
Connection con = DriverManager.getConnection("jdbc:phoenix://localhost:2181”)
______________________________________________________________________________________________

Related Gems in Gemfile:

activerecord-jdbc-adapter
jdbc-mysql


More generally do you have many examples or use cases of OLTP rails applications connecting to phoenix, as most examples I’ve found seem to be Java applications?

Many Thanks,
Josh






--


This is an e-mail from Corax Cyber Security Ltd or Corax Cyber Security
Inc. This email together with any attachments may contain confidential
and/or privileged information. It may be read, copied and used only by the
intended recipient. No one else may place any reliance on it or copy,
disclose or forward all or any of it in any form. If you have received this
email in error, please contact the sender immediately.

If you receive this e-mail in error, please notify us immediately. Although
Corax Cyber Security Ltd and Corax Cyber Security Inc believes this email
and any attachments are free of any virus, it is the responsibility of the
recipient to ensure that it is virus free.


--



This is an e-mail from Corax Cyber Security Ltd or Corax Cyber Security Inc. This email together with any attachments may contain confidential and/or privileged information. It may be read, copied and used only by the intended recipient. No one else may place any reliance on it or copy, disclose or forward all or any of it in any form. If you have received this email in error, please contact the sender immediately.

If you receive this e-mail in error, please notify us immediately. Although Corax Cyber Security Ltd and Corax Cyber Security Inc believes this email and any attachments are free of any virus, it is the responsibility of the recipient to ensure that it is virus free.




This is an e-mail from Corax Cyber Security Ltd or Corax Cyber Security Inc. This email together with any attachments may contain confidential and/or privileged information. It may be read, copied and used only by the intended recipient. No one else may place any reliance on it or copy, disclose or forward all or any of it in any form. If you have received this email in error, please contact the sender immediately.

If you receive this e-mail in error, please notify us immediately. Although Corax Cyber Security Ltd and Corax Cyber Security Inc believes this email and any attachments are free of any virus, it is the responsibility of the recipient to ensure that it is virus free.



--
Russell Jurney twitter.com/rjurney russell.jurney@gmail.com relato.io



This is an e-mail from Corax Cyber Security Ltd or Corax Cyber Security Inc. This email together with any attachments may contain confidential and/or privileged information. It may be read, copied and used only by the intended recipient. No one else may place any reliance on it or copy, disclose or forward all or any of it in any form. If you have received this email in error, please contact the sender immediately.

If you receive this e-mail in error, please notify us immediately. Although Corax Cyber Security Ltd and Corax Cyber Security Inc believes this email and any attachments are free of any virus, it is the responsibility of the recipient to ensure that it is virus free.