I'm trying to deploy simple Rails app on glassfish v3 and get the following error:
org.jruby.rack.RackInitializationException: Could not find RubyGem activerecord-jdbc-adapter (>= 0)
Environment details:
App is packaged as war using warbler.
JRuby 1.4.0 installed locally, with activerecord-jdbc-adapter gem installed.
App is configured to use derby database (migration is successful):
development:
host: localhost
adapter: jdbc
driver: org.apache.derby.jdbc.ClientDriver
url: jdbc:derby://localhost:1527/railsdb
username: rails
password: rails
System: Mac OS 10.6.2
Usually you need to tell Warbler to include the gem in the war file. You can do this by either adding the gem to your config/environment.rb as follows:
config.gem "activerecord-jdbc-adapter", :lib => false
Or by ensuring you have a Warbler configuration file ('warble config') and adding the following entry:
config.gems << "activerecord-jdbc-adapter"
Related
In my Rails app,I need to use oracle database.I installed the oracle 11g client successfully.I can connect the oracle server through:
sqlplus SFUSER/sfuser#SF
Then I connect oracle in Rails:
In databse.yml:
development:
adapter: oracle_enhanced
database: 192.168.0.154/SF
username: SFUSER
password: sfuser
In my Gemfile,I add
gem 'activerecord-oracle_enhanced-adapter', '~> 1.5.4'
gem 'ruby-oci8', '~> 2.1.7'
and run bundle install
All gem are installed successfully.
But when I run:
rails s
I got:
/home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-oracle_enhanced-adapter-1.5.4/lib/active_record/connection_adapters/oracle_enhanced_column_dumper.rb:67:in `<top (required)>': uninitialized constant ActiveRecord::ConnectionAdapters::ColumnDumper (NameError)
I had exactly the same problem. I found this from activerecord-oracle_enhanced-adapter github pages
Oracle enhanced adapter version 1.5 just supports Rails 4 and does not
support Rails 3.2 or lower version of Rails.
...
When using Ruby on Rails version 3 then in Gemfile include
gem 'activerecord-oracle_enhanced-adapter', '~> 1.4.0'
After running bundle install, rails s started to work.
I use Capistrano to deploy a Rails 3.2.1 app that uses mysql2 adapter.
The app is working fine locally on windows, but when i try to deploy to a linux server, Capistrano throws the following error:
Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (mysql2 is not part of the bundle. Add it to Gemfile.)
Please note that i'm tracking Gemfile.lock on GIT but i noticed this:
...
mysql2 (0.3.11-x86-mingw32)
...
The lock file locked the version which is fine, but i think it locked the windows version (x86-mingw32) which might not work on linux.
Any one had the same issue? I don't want to untrack Gemfile.lock because it's not recommended.
My deploy.rb is like:
require "bundler/capistrano"
load "deploy/assets"
... configuration here ...
P.S. I also noticed other gems locked with this part "x86-mingw32", like bcrypt-ruby
Don't worry about any gems with "mingw32" in your Gemfile.lock. Take a look at your Gemfile. Do you have the following line?
gem 'mysql2'
Given this, did you run bundle install at the linux server (or did you put this functionality to your capistrano recipe?)
BTW, if you have any windows-specific gems, and you want to be sure that they are only loaded in this context, use the following condition:
platforms :mswin, :mingw do
# placeholder for gems in a windows environment
end
In the first few rails app I setup for small apps to learn I used
RAILS_ENV=production rake db:setup
and it created the (mysql) tables on myapp_production
But this time I am not able to populate development or test DB. It just writes to production, also the app running on the Mongrel server writes to production DB but says it'S development environment on startup:
$ rails server
WARNING: This version of mysql2 (0.3.6) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
I don't use rvm here (tried on another box and guess I like it)
I am not sure how to troubeshoot this. And there is no error message.
You use old Rails version. mysql2 gem as of 0.3.0 do not support rails 3.0 and earlier. So you need either update rails to 3.1.x or higher or use gem "mysql2", "~> 0.2.7" in your Gemfile. See mysql2 gem page, search for "3.0" in your browser.
Maybe that's the reason.
bonjour dudes.
i have a small problem with rails.
today i install rails 3 and decided create a new project.
rails new blablabla --database=postgresql
i edited database.yml and paste to it my databases, logins and passwords of postgres.
my postgresql works on port 5433 (instead of 5432)
database.yml example:
development:
adapter: postgresql
database: devdb
encoding: utf8
username: postgres
password: mypassword
host: localhost
port: 5433
i just want to start server, or add controller, but rails says:
Could not find gem 'pg (>= 0)' in any of the gem sources listed in your Gemfile
but i have 'pg'. i think problem with port, but i dont know how fix problem.
sorry for bad english, and thanks for answers.
It would appear from the error message that you are using Bundler to manage your gems for the project. Have you tried running bundle install to bring all of your sources in the Gemfile up to date? Here is an example:
> bundle install
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
[...]
Using zendesk_remote_auth (0.9.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
My rails applications run on a shared host. I don't have access to a commandline and can't run the bundle command. I can run a few pre-selected rake commands.
On my development machine, I've done bundle install --deployment, so that all my gems are in vendor/bundle.
Problem is, however, that my development machine is not compatible with my shared host (32/64 bits), so the native extension of the mysql2 gem doesn't work on the shared host. The shared host does have the mysql2 gem installed, though.
If I remove 'mysql2' from the Gemfile, I get this error: !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' (<= this was because I had the adapter set to mysql instead of mysql2 in database.yml:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: db
pool: 5
username: user
password: pass
socket: /var/run/mysqld/mysqld.sock
(same for test/production)
If I keep gem 'mysql2' in my Gemfile, I get this error (which makes sense, because of the native extension was compiled on a different machine:
/home/project/vendor/bundle/ruby/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.so: wrong ELF class: ELFCLASS32 - /home/project/vendor/bundle/ruby/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.so
If I remove gem 'mysql2', I get:
Please install the mysql2 adapter: 'gem install activerecord-mysql2-adapter' (no such file to load -- active_record/connection_adapters/mysql2_adapter)
I would like to specify which gems should be loaded from my own applications vendor/bundle directory and which gems from the system gem directory.
Is this possible with bundler?
What's the best solution for this problem?
Thanks.
Check your database.yml file. Make sure you are not referring to the adapter that you don't have installed in your environment.
Have you checked your gemlock file for -x86 gem references? I had a similar issue deploying from windows xp to 64-bit ubuntu. Modify these to remove the -x86 part and run bundle install again, this should build the 64-bit native gem if all the libraries are on the instance.