How do I add runtime dependency for java with jruby - jruby

I've create a wrapper gem for connecting to a tibco queue & uploaded that gem to my local gemserver. When I try to include the wrapper gem in other projects, I get the following error:
Bundler could not find compatible versions for gem "jruby-jms":
In Gemfile:
jruby-jms (>= 1.2.0, ~> 1.2) java
tibco_client (>= 0) java depends on
jruby-jms (>= 1.2.0, ~> 1.2) ruby
jruby-jms (>= 0) java
jruby-jms (>= 0) ruby
Could not find gem 'jruby-jms (>= 1.2.0, ~> 1.2) ruby in any of the sources
I am trying to figure out how to list the runtime dependency but I can't find any instruction or examples:
spec.platform = 'java'
spec.add_runtime_dependency 'jruby-jms', '~> 1.2', '>= 1.2.0'
Does anybody have experience in resolving something like this? I'm using jruby-1.7.19 (also tried 1.7.4, same result).

I found the problem was in my Gemfile. Syntax found on stackoverflow.
gem 'tibco_client', :source => 'http://gemserver:9292', :platforms => 'jruby'

Related

Building apache ODE from the source Jruby and Buildr

I need to build apache ODE 1.3.5 from the source. Building from the source is important for me because we plan to make some changes in the ODE code. I tried out their instructions for building. I was able to install jruby 1.5.1 but I was not able to install buildr 1.4.4 using the said version of jruby. I googled a bit and it seemed like I had to upgrade to jruby 1.6.2. After the newer version of jruby(1.6.2), I was able to install buildr 1.4.4 but when I go to the root of the ODE source and execute the following command
buildr package test=no
I get the below exceptions on the console
LoadError: no such file to load -- rubygems/source_info_cache
require at org/jruby/RubyKernel.java:1038
require at c:/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29
(root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:41
require at org/jruby/RubyKernel.java:1038
require at c:/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29
(root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:17
require at org/jruby/RubyKernel.java:1038
require at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core.rb:29
(root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr.rb:20
require at org/jruby/RubyKernel.java:1038
require at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr.rb:29
(root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/bin/buildr:18
load at org/jruby/RubyKernel.java:1063
(root) at c:\jruby-1.6.2\bin\buildr:19
I have no idea what I am doing wrong. This is my first interaction with jruby as well as buildr. I appreciate any pointers towards the building of this repository.
Edit 1: Below is the result of jruby -S gem list after installing jruby 1.7.13 and buildr 1.4.19
C:\Users\16030053.CS-6606-DT>jruby -S gem list
*** LOCAL GEMS ***
atoulme-Antwrap (0.7.5 java)
bouncy-castle-java (1.5.0147)
builder (3.2.2)
buildr (1.4.19 java)
bundler (1.15.3)
diff-lcs (1.2.4)
ffi (1.9.3 java)
hoe (3.7.1)
jruby-openssl (0.9.5 java, 0.8.10)
jruby-pageant (1.1.1 java)
jruby-win32ole (0.8.5)
json (1.8.0 java)
json_pure (1.8.0)
krypt (0.0.2)
krypt-core (0.0.2 universal-java)
krypt-provider-jdk (0.0.2)
minitar (0.5.4)
net-sftp (2.1.2)
net-ssh (2.7.0)
orderedhash (0.0.6)
rake (10.1.0, 0.9.2.2)
rdoc (4.0.1)
rspec (2.14.1)
rspec-core (2.14.5)
rspec-expectations (2.14.3)
rspec-mocks (2.14.3)
rubyzip (0.9.9)
xml-simple (1.1.2)
C:\Users\16030053.CS-6606-DT>
Edit 2 When I execute the command buildr package test=no --trace in apache-ode-sources-1.3.5, I get the following errors
F:\apache-ode-sources-1.3.5>buildr package test=no --trace
Buildr aborted!
SyntaxError : F:/apache-ode-sources-1.3.5/tasks/jbi.rake:79: formal argument cannot be an instance variable
Tempfile.open("MANIFEST.MF") { |#jbi_xml_tmp| #jbi_xml_tmp.write descriptor }
^
org/jruby/RubyKernel.java:1081:in `load'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:1:in `(root)'
org/jruby/RubyArray.java:1613:in `each'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:497:in `load_tasks'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:494:in `load_tasks'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:224:in `load_buildfile'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:535:in `standard_exception_handling'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:220:in `load_buildfile'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:130:in `run'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:535:in `standard_exception_handling'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:128:in `run'
org/jruby/RubyKernel.java:1081:in `load'
c:\jruby-1.7.13\bin\buildr:23:in `(root)'
F:\apache-ode-sources-1.3.5>
Below is the response of #sathwik on apache-ode mailing list that helped me compile the ode source for version 1.3.5
Hi Muhammad,
Use jruby 1.7.13 and buildr 1.4.19
Edit file <ode 1.3.5 source>/tasks/jbi.rake. Find and Replace the
initialize method with the content below
def initialize(*args)
super
prepare { path("lib").include((component.libs +
bootstrap.libs).flatten.uniq) }
enhance do
case jbi_xml
when String
path("META-INF").include jbi_xml.path, :as=>"jbi.xml"
when nil, true
# Tempfiles gets deleted on garbage collection, so we're going to
hold on to it
# through instance variable not closure variable.
#jbi_xml_tmp = Tempfile.new('MANIFEST.MF')
#jbi_xml_tmp.write descriptor
path("META-INF").include #jbi_xml_tmp.path, :as=>"jbi.xml"
#jbi_xml_tmp.close
when Proc, Method
#jbi_xml_tmp = Tempfile.new('MANIFEST.MF')
#jbi_xml_tmp.write jbi_xml.call.to_s
path("META-INF").include #jbi_xml_tmp.path, :as=>"jbi.xml"
#jbi_xml_tmp.close
end
end
end
Besides the above changes I had to change line 37 of dependencies.rb
file from
AXIS2_WAR = "org.apache.axis2:axis2-webapp:war:1.3" to
AXIS2_WAR = "org.apache.axis2:axis2-webapp:war:1.6.2"
The above change was needed because all the repositories containing
reference to axis2-webapp:war:1.3 are down. Furthermore, you need to
add following line at the end of repositories.rb file
repositories.remote << "http://people.apache.org/~vanto/m2/"
This is required to fulfill one of the required dependencies namely
xdoclet:xjavadoc-1.1-j5.

Rails5 jruby not able to start

Not able to start rails5 with jruby, getting the following error.
gavinyap#gavin-ubuntu  ~/Development/rails5app  rails s
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from require at bin/rails:4)
Bundler::GemRequireError: There was an error while trying to load the gem 'activerecord-jdbcmysql-adapter'.
Gem Load Error is: uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format
Backtrace for gem load error is:
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:13:in `<module:TypeCast>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:7:in `<module:Jdbc>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:4:in `< module:ConnectionAdapters>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:3:in `<top>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:1:in `singleton cla
Versions of Jruby and Rails
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f
OpenJDK 64-Bit Server
VM 25.91-b14 on 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14 +jit [linux-x86_64]
Rails 5.0.0
The ActiveRecord JDBC gem has not been updated for Rails 5. Checking the project in GitHub shows some development activity early this year but there is no indication when a new gem will be released for Rails 5.
add gem 'activerecord-jdbcmysql-adapter', '~> 5.0.pre1' to your gemfile

JRuby JDBC-mysql error

I have JRuby + Swing application and want to add jdbc/mysql there
require "jdbc/mysql"
But when I'm trying to run it, I have the followig error:
LoadError: no such file to load -- jdbc/mysql
require at org/jruby/RubyKernel.java:1033
(root) at olap_frontend.rb:3
My gem list:
*** LOCAL GEMS ***
activerecord-jdbc-adapter (1.2.2)
activerecord-jdbcmysql-adapter (1.2.2)
bouncy-castle-java (1.5.0146.1)
bundler (1.1.3 ruby)
jdbc-mysql (5.1.13)
jruby-launcher (1.0.12 java)
jruby-openssl (0.7.6.1)
rake (0.9.2, 0.8.7)
rubygems-bundler (0.3.0 ruby)
What I'm doing wrong?
It was my fault - I need to require rubygems first

Issue loading third party JAR when using Warbler and a downgraded JRuby-Rack?

We're using Warbler to deploy our application to JBoss. The server seems to start fine, but when a request is sent to the application we get the following error:
...
JRuby-Rack startup
No such file to load -- lib/mylib
....
As you can see it seems to be crashing out when trying to load the mylib.jar, which is Java library we are using in the user.rb class. I've tripled checked that the mylib.jar file exists in the myapp/lib directory and also that it gets successfully packaged by Warbler (it lives in WEB-INF/lib/mylib.jar).
Please Note: I downgraded JRuby-Rack to 1.0.10 after running into the issue detailed here - NoMethodError: relative_url_root when deploying rails app on tomcat. So perhaps the issue has something to do with this?
I'm at a loss as to what's going on. Any ideas?
Other details that might prove useful:
Java Version: 1.6.0_22
JRuby Version: 1.6.5 (ruby-1.9.2-p136)
Ruby Language Level: 1.9
Gemfile:
gem 'rails', '3.1.1'
...
gem 'warbler'
gem 'jruby-rack', '1.0.10'
...
config/warble.rb:
...
config.dirs = %w(app config lib log vendor tmp)
...
config.webxml.jruby.compat.version = "1.9"
...
app/model/user.rb:
require 'java'
require 'lib/mylib.jar'
...
Full Back Trace:
...
14:53:49,552 INFO [Server] JBoss (MX MicroKernel) [4.3.0.GA_CP01 (build: SVNTag=JBPAPP_4_3_0_GA_CP01 date=200804211657)] Started in 28s:311ms
14:54:33,799 ERROR [STDERR] /usr/local/appserver/jboss4.3/server/ruby/tmp/deploy/tmp4492943940433390521myapp-exp.war/WEB-INF/gems/gems/rack-1.3.5/lib/rack.rb:14 warning: already initialized constant VERSION
14:54:37,614 ERROR [STDERR] /usr/local/appserver/jboss4.3/server/ruby/tmp/deploy/tmp4492943940433390521myapp-exp.war/WEB-INF/gems/gems/jruby-rack-1.0.10/lib/jruby/rack/version.rb:10 warning: already initialized constant VERSION
14:54:41,881 INFO [ContainerBase] Warning: no min runtimes specified.
14:54:41,888 INFO [ContainerBase] Warning: no max runtimes specified.
14:54:41,895 INFO [ContainerBase] An exception happened during JRuby-Rack startup
No such file to load -- lib/mylib
--- System
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) Server VM 1.6.0_22) [linux-i386-java]
Time: 2011-11-28 14:54:41 +0000
Server: JBossWeb/2.0.0.GA_CP05
jruby.home: file:/usr/local/appserver/jboss4.3/server/ruby/tmp/deploy/tmp4492943940433390521myapp-exp.war/WEB-INF/lib/jruby-stdlib-1.6.5.jar!/META-INF/jruby.home
--- Context Init Parameters:
com.sun.faces.injectionProvider = org.jboss.web.jsf.integration.injection.JBossInjectionProvider
jruby.compat.version = 1.9
public.root = /
rails.env = production
--- Backtrace
LoadError: No such file to load -- lib/mylib
...
Output of 'gem list':
$ gem list
*** LOCAL GEMS ***
actionmailer (3.1.1)
actionpack (3.1.1)
activemodel (3.1.1)
activerecord (3.1.1)
activeresource (3.1.1)
activesupport (3.1.1)
arel (2.2.1)
bouncy-castle-java (1.5.0146.1)
builder (3.0.0)
bundler (1.0.21)
capybara (1.1.2)
childprocess (0.2.3, 0.2.2)
ci_reporter (1.6.5)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.3)
cucumber (1.1.3)
cucumber-rails (1.2.0)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
ffi (1.0.11 java)
gherkin (2.6.8 java)
haml (3.1.3)
haml-rails (0.3.4)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.19, 1.0.18)
jruby-jars (1.6.5)
jruby-launcher (1.0.9 java)
jruby-openssl (0.7.4)
jruby-rack (1.0.10)
json (1.6.2, 1.6.1 java)
json_pure (1.6.2, 1.6.1)
mail (2.3.0)
mime-types (1.17.2)
multi_json (1.0.3)
nokogiri (1.5.0 java)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.1)
railties (3.1.1)
rake (0.9.2.2, 0.8.7)
rcov (0.9.11 java)
rdoc (3.11)
rspec (2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
rspec-mocks (2.7.0)
rspec-rails (2.7.0)
rubyzip (0.9.5, 0.9.4)
sass (3.1.10)
sass-rails (3.1.5)
selenium-webdriver (2.13.0)
spork (0.9.0.rc9)
sprockets (2.0.3)
term-ansicolor (1.0.7)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
uglifier (1.1.0)
warbler (1.3.2)
xpath (0.1.4)
How are you requiring your jar.
if it's
require 'lib/myjar'
try changing it to
require 'myjar'
and see if that works

can't activate mysql2 (~> 0.3.6), already activated mysql2-0.3.2 in Rails 3.1

I'm just trying to get the most basic of basic shell of a rails app running under 3.1, and I'm getting this weird error when I run bundle exec rake db:migrate-
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (can't activate mysql2 (~> 0.3.6), already activated mysql2-0.3.2. Make sure all dependencies are added to Gemfile.)
All the posts that I've read here and elsewhere say I should be using the newer mysql2 adaptor for rails 3.1, so I have-
gem 'mysql2', '0.3.2'
in my gemfile. Some post have suggested using-
gem 'mysql2', '~> 0.3'
but that gets me the same error. The gem is installed at-
/Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/mysql2-0.3.2
It was suggested that I switch up that line in my gemfile again, this time to be-
gem 'mysql2', '< 0.3'
but when I do that, run bundle install, and then try to run migrations again, I get-
An error has occurred, all later migrations canceled:
undefined method `rows' for nil:NilClass
My complete migration file looks like this-
class CreatePlaces < ActiveRecord::Migration
def change
create_table :places do |t|
t.string :title
t.string :meta_description
t.string :permalink, :limit => 60
t.string :name, :limit => 60
t.string :address
t.string :state, :limit => 2
t.string :region, :limit => 3
t.float :latitude
t.float :longitude
t.text :description
t.boolean :active, :default => true
t.timestamps
end
add_index :places, [:permalink, :state, :region, :latitude, :longitude, :active], :name => 'places_index'
end
end
And the full output of running that migration is-
== CreatePlaces: migrating ===================================================
-- create_table(:places)
-> 0.0925s
-- add_index(:places, [:permalink, :state, :region, :latitude, :longitude, :active], {:name=>"places_index"})
-> 0.1097s
== CreatePlaces: migrated (0.2023s) ==========================================
rake aborted!
An error has occurred, all later migrations canceled:
undefined method `rows' for nil:NilClass
There are no later migrations, that's the only one, as this is an app that I'm just starting to try to get Rails 3.1 running properly. Dropping the database and recreating it gets me to the same place.
I am able to access Places from the console-
ruby-1.9.2-p180 :001 > Place
(0.3ms) SHOW TABLES
(0.1ms) SHOW TABLES
(1.1ms) describe `places`
=> Place(id: integer, title: string, meta_description: string, permalink: string, name: string, address: string, state: string, region: string, latitude: float, longitude: float, description: text, active: boolean, created_at: datetime, updated_at: datetime)
But when I actually try to do a find or anything on Places, I get the following error-
Place.find(:all)
ArgumentError: wrong number of arguments (3 for 2)
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/mysql2-0.2.7/lib/active_record/connection_adapters/mysql2_adapter.rb:634:in `select'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/activerecord-3.1.0.rc5/lib/active_record/connection_adapters/abstract/database_statements.rb:9:in `select_all'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/activerecord-3.1.0.rc5/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/activerecord-3.1.0.rc5/lib/active_record/base.rb:470:in `find_by_sql'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/activerecord-3.1.0.rc5/lib/active_record/relation.rb:111:in `to_a'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/activerecord-3.1.0.rc5/lib/active_record/relation/finder_methods.rb:155:in `all'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/activerecord-3.1.0.rc5/lib/active_record/relation/finder_methods.rb:105:in `find'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/activerecord-3.1.0.rc5/lib/active_record/base.rb:437:in `find'
from (irb):2
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/railties-3.1.0.rc5/lib/rails/commands/console.rb:45:in `start'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/railties-3.1.0.rc5/lib/rails/commands/console.rb:8:in `start'
from /Users/mark/.rvm/gems/ruby-1.9.2-p180#rails310pre/gems/railties-3.1.0.rc5/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Anyone have any ideas? I've been digging for like 18 hours now, and just running in circles.
Thanks,
--Mark
Active Record has it's own requirements on which versions of mysql2 are compatible. Here's the line of code for Rails 3.1. You must use a version of mysql2 that satisfies these requirements.
Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (can't activate mysql2 (~> 0.3.6), already activated mysql2-0.3.2. Make sure all dependencies are added to Gemfile.)
This is saying Rails expects a mysql2 version greater than 0.3.6 and less than 0.4.0, but found version 0.3.2. If you change your Gemfile to request a version in this range then Active Record should be happy. Perhaps
gem 'mysql2', '0.3.6'
Don't forget to update your bundle after changing your Gemfile.
bundle update mysql2
I know this is a very old thread but because it still comes up in Google results a one of the first results I though I would updated it with I had to do work around this issue in newer versions of Rails.
The errors shows as:
Gem::LoadError: Specified 'mysql2' for database adapter,
but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile
followed by:
Gem::LoadError: can't activate mysql2 (< 0.5, >= 0.3.13),
already activated mysql2-0.5.2. Make sure all dependencies are
added to Gemfile.
I already had the gem added in my Gemfile as shown below:
group :production do
gem 'mysql2'
end
but I had to update it to prevent from picking up a version outside of the range indicated in the error message. Notice the '< 0.5' below:
group :production do
gem 'mysql2', '< 0.5'
end
Additionally, different versions of Rails set different min/max version restrictions for the MySQL gem:
From
https://github.com/brianmario/mysql2/issues/950#issuecomment-376375844
"Correct, Rails 4.x cannot use mysql2 0.5.x. The actual code would
work fine, but Rails 4 has a version restriction in place to prevent
use of mysql2 0.5.x. This is intentional, as it allows future changes
to the API without silently risking their use in older code not
prepared to use the new APIs. There's also nothing magic about the
version numbers -- it's totally by coincidence that Rails 4 uses
mysql2 0.4 and Rails 5 will be able to use mysql2 0.4 or 0.5."
This also had me pulling out my hair. To only reasonable solution I could get was to switch to the master branch of the mysql2 gem.
gem 'mysql2', :git => 'git://github.com/brianmario/mysql2.git'
After this update my Rails 3.1.0.rc5 application could start with MySQL. (At the time of this post the latest version of the gem was 0.3.6)
I have the same issue several times with an Redmine implementation.
I changed a gem line place on
RUBYGEM#VERSION/gems/activerecord-3.2.22.2/lib/active_record/connection_adapters/mysql2_adapter.rb
In the line 3 change this
gem 'mysql2', '~> 0.3.10'
with this
gem 'mysql2', '~> 0.4.10' (or whatever version you need)
And all works fine
if anyone here is stuggling with this in 2022 with the new M2 book
"can't activate mysql2 (~> 0.3.10), already activated mysql2-0.5.2"
you have to update this file:
/usr/local/bundle/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/mysql2_adapter.rb:3
and change it to the version of the mysql gem you are using.
Pretty old question, so I'm assuming the original poster has already solved the issue. However, in case anyone is coming to this post trying to solve the first issue:
Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (can't activate mysql2 (~> 0.3.6), already activated mysql2-0.3.2. Make sure all dependencies are added to Gemfile.)
This is most likely occurring because you are not running your migrations via bundle exec. Try running bundle exec rake db:migrate.