在 jruby 的 db:migrate 上获取空指针异常
Getting null pointer exception on db:migrate for jruby
我正在尝试 运行 耙 db:migrate
。这是我遇到的错误
/Users/kartik/.rbenv/versions/jruby-9.1.5.0/lib/ruby/gems/shared/gems/rake-11.2.2/lib/rake/task.rb:197: warning: singleton on non-persistent Java type Java::JavaLang::NullPointerException (http://wiki.jruby.org/Persistence)
rake aborted!
Java::JavaLang::NullPointerException:
arjdbc.jdbc.RubyJdbcConnection.isAr42(RubyJdbcConnection.java:3167)
arjdbc.jdbc.RubyJdbcConnection.setStatementParameter(RubyJdbcConnection.java:2172)
arjdbc.jdbc.RubyJdbcConnection.setStatementParameters(RubyJdbcConnection.java:2162)
arjdbc.jdbc.RubyJdbcConnection.call(RubyJdbcConnection.java:855)
arjdbc.jdbc.RubyJdbcConnection.call(RubyJdbcConnection.java:840)
arjdbc.jdbc.RubyJdbcConnection.withConnection(RubyJdbcConnection.java:3486)
arjdbc.jdbc.RubyJdbcConnection.withConnection(RubyJdbcConnection.java:3467)
arjdbc.jdbc.RubyJdbcConnection.doExecuteQueryRaw(RubyJdbcConnection.java:840)
arjdbc.jdbc.RubyJdbcConnection.executePreparedQueryRaw(RubyJdbcConnection.java:835)
arjdbc.jdbc.RubyJdbcConnection.execute_query_raw(RubyJdbcConnection.java:815)
arjdbc.jdbc.RubyJdbcConnection$INVOKER$i$execute_query_raw.call(RubyJdbcConnection$INVOKER$i$execute_query_raw.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:209)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:205)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:324)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:77)
org.jruby.runtime.Block.yieldSpecific(Block.java:136)
org.jruby.ir.runtime.IRRuntimeHelpers.yieldSpecific(IRRuntimeHelpers.java:486)
org.jruby.ir.instructions.YieldInstr.interpret(YieldInstr.java:74)
jruby --version
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.102-b14 on 1.8.0_102-b14 +jit [darwin-x86_64]
'activerecord-jdbcpostgresql-adapter', '1.3.20'
https://github.com/jruby/activerecord-jdbc-adapter/pull/740
中描述了该问题
将 activerecord-jdbc-adapter 升级到版本 1.3.21 后问题得到解决。将您的 Gemfile 更新为如下内容:
gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3.21'
我正在尝试 运行 耙 db:migrate
。这是我遇到的错误
/Users/kartik/.rbenv/versions/jruby-9.1.5.0/lib/ruby/gems/shared/gems/rake-11.2.2/lib/rake/task.rb:197: warning: singleton on non-persistent Java type Java::JavaLang::NullPointerException (http://wiki.jruby.org/Persistence)
rake aborted!
Java::JavaLang::NullPointerException:
arjdbc.jdbc.RubyJdbcConnection.isAr42(RubyJdbcConnection.java:3167)
arjdbc.jdbc.RubyJdbcConnection.setStatementParameter(RubyJdbcConnection.java:2172)
arjdbc.jdbc.RubyJdbcConnection.setStatementParameters(RubyJdbcConnection.java:2162)
arjdbc.jdbc.RubyJdbcConnection.call(RubyJdbcConnection.java:855)
arjdbc.jdbc.RubyJdbcConnection.call(RubyJdbcConnection.java:840)
arjdbc.jdbc.RubyJdbcConnection.withConnection(RubyJdbcConnection.java:3486)
arjdbc.jdbc.RubyJdbcConnection.withConnection(RubyJdbcConnection.java:3467)
arjdbc.jdbc.RubyJdbcConnection.doExecuteQueryRaw(RubyJdbcConnection.java:840)
arjdbc.jdbc.RubyJdbcConnection.executePreparedQueryRaw(RubyJdbcConnection.java:835)
arjdbc.jdbc.RubyJdbcConnection.execute_query_raw(RubyJdbcConnection.java:815)
arjdbc.jdbc.RubyJdbcConnection$INVOKER$i$execute_query_raw.call(RubyJdbcConnection$INVOKER$i$execute_query_raw.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:209)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:205)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:324)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:77)
org.jruby.runtime.Block.yieldSpecific(Block.java:136)
org.jruby.ir.runtime.IRRuntimeHelpers.yieldSpecific(IRRuntimeHelpers.java:486)
org.jruby.ir.instructions.YieldInstr.interpret(YieldInstr.java:74)
jruby --version
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.102-b14 on 1.8.0_102-b14 +jit [darwin-x86_64]
'activerecord-jdbcpostgresql-adapter', '1.3.20'
https://github.com/jruby/activerecord-jdbc-adapter/pull/740
中描述了该问题将 activerecord-jdbc-adapter 升级到版本 1.3.21 后问题得到解决。将您的 Gemfile 更新为如下内容:
gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3.21'