与Jruby一起使用activerecord-jdbcsqlite3-adapter时出现load_java_part错误

时间:2016-03-16 03:26:05

标签: ruby-on-rails activerecord jruby jrubyonrails

我在很长一段时间内都遇到了问题而且我迫切需要解决方案。 我有一个Web应用程序,必须在Windows 7上移植到WAR。我使用的数据库是Sqlit3 Ruby版本: - ruby​​ 2.1.5p273(2014-11-13修订版48405)[i386-mingw32]
JRuby版本: - jruby 9.0.5.0(2.2.3)2016-01-26 7bee00d Java HotSpot(TM)64位服务器VM 24.45 -b08 on 1.7.0_45-b18 + jit [Windows 7-amd64]
Rails版本: - Rails 4.2.6

在将它移植到WAR之前,这些是我所做的步骤。这些步骤适用于许多系统,但对于少数系统我无法通过, 1)我安装了JRuby 2)我通过运行 gem install rails -N
在Jruby上安装了rails 3)我删除了 gem sqlite3 并添加 gem'activerecord-jdbcsqlite3-adapter'(使其与java兼容)

捆绑安装后,

当我运行 rails c 命令时,

我得到以下例外,

* activerecord-jdbc-adapter仅用于JRuby C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-jdbc-adapter-1 .3.20 / lib / arjdbc / sqlite3 / adapter.rb:1:in require' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-j dbc-adapter-1.3.20/lib/arjdbc/sqlite3.rb:2:in l oad_java_part'用于ArJdbc:模块(NoMethodError)         来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-j dbc-adapter-1.3.20 / lib / arjdbc / sqlite3.rb:2:in require' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-j dbcsqlite3-adapter-1.3.20/lib/activerecord-jdbcsqlite3-adapter.rb:3:in'         来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-j dbcsqlite3-adapter-1.3.20 / lib / activerecord -jdbcsqlite3-adapter.rb:3:in require' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:76:in'         来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/ lib / bundler / runtime.rb:76:在each' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:72:in块中(2级)in require'         来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/ lib / bundler / runtime.rb:72:在each' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:61:in块中的require'         来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/ lib / bundler / runtime.rb:61:在require' from D:/srikanth-work/simple/config/application.rb:7:in require'中         来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/ lib / bundler.rb:133:在require' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6 /lib/rails/commands/commands_tasks.rb:78:in

  

”           来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6   /lib/rails/commands/commands_tasks.rb:78:in tap' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6 /lib/rails/commands/commands_tasks.rb:75:in阻止服务器'           来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6   /lib/rails/commands/commands_tasks.rb:75:in run_command!' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6 /lib/rails/commands.rb:17:in server'           来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6   /lib/rails/commands/commands_tasks.rb:39:in require' from bin/rails:4:in'           来自bin / rails:4:{{1}}'*

任何建议都会非常有用

2 个答案:

答案 0 :(得分:0)

activerecord-jdbc-adapter用于JRuby 表示你在非JRuby(MRI)下加载它

如果您需要使用单个 Gemfile 在JRuby和MRI下运行,则Bundler具有平台说明符:

gem 'activerecord-jdbc-adapte', platform: :jruby

答案 1 :(得分:-2)

我在tomcat上构建部署..
在浏览器上打开应用程序时出现以下错误,
退出org / jruby / RubyKernel.java:852:退出'来自org / jruby / RubyKernel.java:815:inmerit'来自D:/sotwares/Tomcats/apache-tomcat-8.0.28/webapps/helloworld/WEB-INF/gems/gems/bundler-1.7.7/lib/bundler/setup.rb:14:in(root)&# 39;来自org / jruby / RubyKernel.java:1040:inrequire'来自/D:/sotwares/Tomcats/apache-tomcat-8.0.28/webapps/helloworld/WEB-INF/lib/jruby-stdlib-1.7.24.jar!/META-INF/jruby.home/lib/ruby/ shared / ruby​​gems / core_ext / kernel_require.rb:1:in(root)'来自/D:/sotwares/Tomcats/apache-tomcat-8.0.28/webapps/helloworld/WEB-INF/lib/jruby-stdlib-1.7.24.jar!/META-INF/jruby.home/lib/ruby/共享/的rubygems / core_ext / kernel_require.rb:128:inrequire'来自org / jruby / RubyKernel.java:1040:in require'来自D:/sotwares/Tomcats/apache-tomcat-8.0.28/webapps/helloworld/WEB-INF/config/boot.rb:3:in(root)'来自/D:/sotwares/Tomcats/apache-tomcat-8.0.28/webapps/helloworld/WEB-INF/lib/jruby-stdlib-1.7.24.jar!/META-INF/jruby.home/lib/ruby/ shared / ruby​​gems / core_ext / kernel_require.rb:1:in(root)'来自/D:/sotwares/Tomcats/apache-tomcat-8.0.28/webapps/helloworld/WEB-INF/lib/jruby-stdlib-1.7.24.jar!/META-INF/jruby.home/lib/ruby/共享/的rubygems / core_ext / kernel_require.rb:54:inrequire'来自档案:/ D:/sotwares/Tomcats/apache-tomcat-8.0.28/webapps/helloworld/WEB-INF/lib/jruby-rack-1.1.20.jar!/jruby/rack/rails/environment3.rb: 23:在`load_environment'您之所以看到此错误,是因为您使用的是JRuby :: Rack :: ErrorApp :: ShowStatus