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
Related
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.
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
Recently changed this heroku app to mysql and now im getting this error with the asset pipeline
this is the complete output from heroku, I followed all the steps recomended by heroku to do this but nothing has worked.
i have this set on my application.rb
config.assets.initialize_on_precompile = false
also i have set the DATABASE_URL with the new mysql connection string trough heroku config.
This is basically the error im getting when deploying to heroku, im almost sure that this must be something really simple, but i just havent been able to figure it out.
Compiled application.css (2781ms) (pid 1424)
rake aborted!
same file: /tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/public/assets/+ and /tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/public/assets/+
Any Help would be greatly appreciated.
Fetching repository, done.
Counting objects: 306, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (242/242), done.
Writing objects: 100% (248/248), 43.37 KiB, done.
Total 248 (delta 171), reused 2 (delta 1)
-----> Removing .DS_Store files
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using 1.5.2
Ruby version change detected. Clearing bundler cache.
Old: ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
New: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Fetching git://github.com/rweng/jquery-datatables-rails.git
Installing Ascii85 (1.0.2)
Installing multi_json (1.8.4)
Installing builder (3.0.4)
Installing i18n (0.6.9)
Installing rake (10.1.1)
Installing journey (1.0.4)
Installing erubis (2.7.0)
Installing hike (1.2.3)
Installing rack (1.4.5)
Installing tilt (1.4.1)
Installing polyglot (0.3.3)
Installing mime-types (1.25.1)
Installing orm_adapter (0.4.0)
Installing sass (3.2.2)
Installing thor (0.18.1)
Installing fastercsv (1.5.5)
Installing has_scope (0.5.1)
Installing arel (3.0.3)
Using bundler (1.5.2)
Installing bcrypt-ruby (3.0.1)
Installing json (1.8.1)
Installing bootstrap-datetimepicker-rails (0.0.11)
Installing tzinfo (0.3.38)
Installing choice (0.1.6)
Installing coffee-script-source (1.4.0)
Installing hashery (2.1.0)
Installing ruby-rc4 (0.1.5)
Installing ttfunk (1.0.3)
Installing ruby-graphviz (1.0.8)
Installing rails_serve_static_assets (0.0.1)
Installing will_paginate (3.0.3)
Installing rails_stdout_logging (0.0.3)
Installing execjs (1.4.0)
Installing webrick (1.3.1)
Installing rack-cache (1.2)
Installing activesupport (3.2.9)
Installing rails-i18n (0.7.0)
Installing rack-test (0.6.2)
Installing rack-ssl (1.3.3)
Installing mysql2 (0.3.14)
Installing warden (1.2.1)
Installing sprockets (2.2.2)
Installing bourbon (2.1.2)
Installing bootstrap-sass (3.1.0.2)
Installing treetop (1.4.15)
Installing haml (4.0.5)
Installing pdf-reader (1.2.0)
Installing rails_12factor (0.0.2)
Installing coffee-script (2.2.0)
Installing uglifier (1.3.0)
Installing rdoc (3.12.2)
Installing activemodel (3.2.9)
Installing activerecord-mysql2-adapter (0.0.3)
Installing arbre (1.0.1)
Installing mail (2.4.4)
Installing activerecord (3.2.9)
Installing actionpack (3.2.9)
Installing activeresource (3.2.9)
Installing polyamorous (0.5.0)
Installing rails-erd (1.0.0)
Installing actionmailer (3.2.9)
Installing prawn (0.12.0)
Installing formtastic (2.2.1)
Installing kaminari (0.14.1)
Installing meta_search (1.1.3)
Installing railties (3.2.9)
Installing rails (3.2.9)
Installing responders (0.9.3)
Installing jquery-rails (2.1.3)
Installing devise (2.1.2)
Using jquery-datatables-rails (1.11.1) from git://github.com/rweng/jquery-datatables-rails.git (at master)
Installing coffee-rails (3.2.2)
Installing sass-rails (3.2.5)
Installing inherited_resources (1.3.1)
Installing jquery-ui-rails (2.0.2)
Installing activeadmin (0.5.0)
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
Post-install message from ruby-graphviz:
Since version 0.9.2, Ruby/GraphViz can use Open3.popen3 (or not)
On Windows, you can install 'win32-open3'
You need to install GraphViz (http://graphviz.org/) to use this Gem.
For more information about Ruby-Graphviz :
* Doc : http://rdoc.info/projects/glejeune/Ruby-Graphviz
* Sources : http://github.com/glejeune/Ruby-Graphviz
* NEW - Mailing List : http://groups.google.com/group/ruby-graphviz
Last (important) changes :
* GraphViz#add_edge is deprecated, use GraphViz#add_edges
* GraphViz#add_node is deprecated, use GraphViz#add_nodes
* GraphViz::Edge#each_attribut is deprecated, use GraphViz::Edge#each_attribute
* GraphViz::GraphML#attributs is deprecated, use GraphViz::GraphML#attributes
* GraphViz::Node#each_attribut is deprecated, use GraphViz::Node#each_attribute
Post-install message from haml:
HEADS UP! Haml 4.0 has many improvements, but also has changes that may break
your application:
* Support for Ruby 1.8.6 dropped
* Support for Rails 2 dropped
* Sass filter now always outputs <style> tags
* Data attributes are now hyphenated, not underscored
* html2haml utility moved to the html2haml gem
* Textile and Maruku filters moved to the haml-contrib gem
For more info see:
http://rubydoc.info/github/haml/haml/file/CHANGELOG.md
Post-install message from pdf-reader:
********************************************
v1.0.0 of PDF::Reader introduced a new page-based API. There are extensive
examples showing how to use it in the README and examples directory.
For detailed documentation, check the rdocs for the PDF::Reader,
PDF::Reader::Page and PDF::Reader::ObjectHash classes.
The old API is marked as deprecated but will continue to work with no
visible warnings for now.
********************************************
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Post-install message from prawn:
********************************************
A lot has changed since 0.8.4
Please read the changelog for details:
https://github.com/sandal/prawn/wiki/CHANGELOG
********************************************
Post-install message from meta_search:
*** Thanks for installing MetaSearch! ***
Be sure to check out http://metautonomo.us/projects/metasearch/ for a
walkthrough of MetaSearch's features, and click the donate button if
you're feeling especially appreciative. It'd help me justify this
"open source" stuff to my lovely wife. :)
Bundle completed (22.89s)
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Compiled jquery.js (3ms) (pid 1424)
Compiled jquery_ujs.js (0ms) (pid 1424)
Compiled bootstrap.js (172ms) (pid 1424)
Compiled bootstrap/affix.js (0ms) (pid 1424)
Compiled bootstrap/alert.js (0ms) (pid 1424)
Compiled bootstrap/button.js (0ms) (pid 1424)
Compiled bootstrap/carousel.js (0ms) (pid 1424)
Compiled bootstrap/collapse.js (0ms) (pid 1424)
Compiled bootstrap/dropdown.js (0ms) (pid 1424)
Compiled bootstrap/tab.js (0ms) (pid 1424)
Compiled bootstrap/transition.js (0ms) (pid 1424)
Compiled bootstrap/scrollspy.js (0ms) (pid 1424)
Compiled bootstrap/modal.js (0ms) (pid 1424)
Compiled bootstrap/tooltip.js (0ms) (pid 1424)
Compiled bootstrap/popover.js (0ms) (pid 1424)
Compiled typeahead.js (1ms) (pid 1424)
Compiled dataTables/jquery.dataTables.js (3ms) (pid 1424)
Compiled dataTables/jquery.dataTables.bootstrap.js (0ms) (pid 1424)
Compiled bootstrap-datetimepicker.js (0ms) (pid 1424)
Compiled jquery-ui.js (5ms) (pid 1424)
Compiled active_admin/lib/namespace.js (173ms) (pid 1424)
Compiled active_admin/components/jquery.aa.checkbox-toggler.js (184ms) (pid 1424)
Compiled active_admin/components/jquery.aa.dropdown-menu.js (198ms) (pid 1424)
Compiled active_admin/components/jquery.aa.popover.js (196ms) (pid 1424)
Compiled active_admin/components/jquery.aa.table-checkbox-toggler.js (179ms) (pid 1424)
Compiled active_admin/pages/application.js (168ms) (pid 1424)
Compiled active_admin/pages/batch_actions.js (166ms) (pid 1424)
Compiled active_admin/application.js (1393ms) (pid 1424)
Compiled active_admin/base.js (1461ms) (pid 1424)
Compiled active_admin.js (1471ms) (pid 1424)
Compiled asignacion_tecnicos.js (169ms) (pid 1424)
Compiled caso_facturados.js (175ms) (pid 1424)
Compiled clientes.js (172ms) (pid 1424)
Compiled historial_tecnicos.js (203ms) (pid 1424)
Compiled registro_casos.js (164ms) (pid 1424)
Compiled tecnicos.js (164ms) (pid 1424)
Compiled application.js (3030ms) (pid 1424)
Compiled index.css (0ms) (pid 1424)
Compiled dataTables/jquery.dataTables.bootstrap.css (45ms) (pid 1424)
Compiled application.css (2781ms) (pid 1424)
rake aborted!
same file: /tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/public/assets/+ and /tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/public/assets/+
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/asset.rb:157:in `write_to'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/static_compiler.rb:39:in `block in write_asset'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/static_compiler.rb:36:in `tap'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/static_compiler.rb:36:in `write_asset'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/static_compiler.rb:20:in `block in compile'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/static_compiler.rb:18:in `compile'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:56:in `internal_precompile'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
/tmp/build_0aa9e509-f693-452f-885c-d32e2be60991/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
Heroku uses PostgreSQL database so you need to use 'pg' gem in production environment. You can use MySql in development mode
In your Gemfile change 'mysql2' gem with
group :development do
gem 'mysql2', '~> 0.3.15'
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
Now run bundle install --without production to install the gems
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
I've been wrestling with this problem for a day or so and cannot figure out what's going on. I'm trying to run a script to import my Wordpress .sql into Jekyll and convert everything to markdown. But every time I run the script (on both Mac and Ubuntu) I'm getting an error. I'm at a loss of what to do. Here's my terminal output and gem list:
jason#ubuntu:~$ ruby -r './wordpress.rb' -e 'Jekyll::WordPress.process( "#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': LoadError: no such file to load -- mysql (Sequel::AdapterNotFound)
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/adapters/mysql.rb:4
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `k_require'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:249:in `tsk_require'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:72:in `check_requiring_thread'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:69:in `synchronize'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:69:in `check_requiring_thread'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:249:in `tsk_require'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/database/connecting.rb:25:in `adapter_class'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/database/connecting.rb:63:in `connect'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:119:in `connect'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:282:in `adapter_method'
from /var/lib/gems/1.8/gems/sequel-3.22.0/lib/sequel/core.rb:289:in `mysql'
from ./wordpress.rb:35:in `process'
from -e:1
jason#ubuntu:~$ gem list
*** LOCAL GEMS ***
classifier (1.3.3)
directory_watcher (1.4.0)
fast-stemmer (1.0.0)
jekyll (0.10.0)
liquid (2.2.2)
maruku (0.6.0)
sequel (3.22.0)
syntax (1.0.0)
I'm using Paul Stamatiou's adapted script. Thanks ahead of time for any suggestions!
If you focus on the actual error message:
LoadError: no such file to load -- mysql
It's fairly obvious that you need to install the mysql gem:
gem install mysql