I'm getting the following error from a JRuby wrapping of the ActiveMerchant library:
org.jruby.exceptions.RaiseException: (NameError) uninitialized constant ActiveMerchant::Billing::SecurePayAuGateway
at org.jruby.RubyModule.const_missing(org/jruby/RubyModule.java:3345)
at org.jruby.RubyModule.const_get(org/jruby/RubyModule.java:3290)
at RUBY.createGateway(classpath:/scripts/main.rb:79)
The code initiating it is:
gateway = ActiveMerchant::Billing::const_get(name).new(options)
I think this is happening because there is some dynamic loading of the gateways happening in gateways.rb:
module ActiveMerchant
module Billing
load_path = Pathname.new(__FILE__ + '/../../..')
Dir[File.dirname(__FILE__) + '/gateways/**/*.rb'].each do |filename|
gateway_name = File.basename(filename, '.rb')
gateway_classname = "#{gateway_name}_gateway".camelize
gateway_filename = Pathname.new(filename).relative_path_from(load_path).sub_ext('')
autoload(gateway_classname, gateway_filename)
end
end
end
This works during unit tests because the Ruby files are real files in my target directory. However in the final application, the Ruby files are contained within a Jar which is in a Jar.
Anyone know why this is happening and how to get it to work?
Which gateway are you trying to teach? From Active Merchant's github there is no
But there is a
And a
To test, instead of
Try
If this works, you know the problem is your gateway = method and you can fix this accordingly