首页 新闻 会员 周边 捐助

关于java调用ruby的问题。

0
悬赏园豆:10 [已关闭问题] 关闭于 2017-09-07 10:54

java调用ruby脚本,发生错误:

LoadError: load error: jopenssl/load -- java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
require at org/jruby/RubyKernel.java:959
require at /opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
<main> at /opt/jruby/lib/ruby/stdlib/openssl.rb:1
require at org/jruby/RubyKernel.java:959
require at /opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
<main> at /opt/jruby/lib/ruby/stdlib/net/https.rb:1
require at org/jruby/RubyKernel.java:959
require at /opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
<main> at /opt/jruby/lib/ruby/stdlib/net/https.rb:23
require at org/jruby/RubyKernel.java:959
(root) at /opt/jruby/lib/ruby/gems/shared/gems/nexpose-6.0.0/lib/nexpose.rb:1
<main> at /opt/jruby/lib/ruby/gems/shared/gems/nexpose-6.0.0/lib/nexpose.rb:53
javax.script.ScriptException: org.jruby.embed.EvalFailedException: (LoadError) load error: jopenssl/load -- java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
at org.jruby.embed.jsr223.JRubyEngine.wrapException(JRubyEngine.java:104)
at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:121)
at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:146)
at dac.dcp.impl.collector.webservice.workers.task.nexpose.executeRuby.RubyInterface.main(RubyInterface.java:381)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.jruby.embed.EvalFailedException: (LoadError) load error: jopenssl/load -- java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:131)
at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:118)
... 7 more
Caused by: org.jruby.exceptions.RaiseException: (LoadError) load error: jopenssl/load -- java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:959)
at opt.jruby.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
at RUBY.<main>(/opt/jruby/lib/ruby/stdlib/openssl.rb:1)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:959)
at opt.jruby.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
at RUBY.<main>(/opt/jruby/lib/ruby/stdlib/net/https.rb:1)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:959)
at opt.jruby.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
at RUBY.<main>(/opt/jruby/lib/ruby/stdlib/net/https.rb:23)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:959)
at RUBY.(root)(/opt/jruby/lib/ruby/gems/shared/gems/nexpose-6.0.0/lib/nexpose.rb:1)
at RUBY.<main>(/opt/jruby/lib/ruby/gems/shared/gems/nexpose-6.0.0/lib/nexpose.rb:53)
17/08/23 17:56:41 ERROR executeRuby.RubyInterface: org.jruby.embed.EvalFailedException: (LoadError) load error: jopenssl/load -- java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z

 

源代码如下:

ScriptEngineManager manager = new ScriptEngineManager();
engine = manager.getEngineByName("jruby");
System.out.println(engine);
try {
engine.eval(new BufferedReader(new FileReader("conf/service/asset.rb")));
/*invocable = (Invocable) engine;
invocable.invokeFunction("getSite");*/
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage());
}

ruby脚本:
class Site
  def hello()
    puts 'hello'
  end
end
def getSite
  Site.new
end
 
程序虾的主页 程序虾 | 菜鸟二级 | 园豆:202
提问于:2017-08-23 18:19
< >
分享
所有回答(1)
0

请问你知道怎么解决了吗

Zoe_only | 园豆:202 (菜鸟二级) | 2017-10-26 16:04
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册