glassfish gem无法在Windows上启动

时间:2010-12-09 15:54:31

标签: ruby-on-rails windows glassfish jruby

我正在尝试使用jruby和glassfish gem在Windows服务器上运行rails 3应用程序。我可以使用“rails s”运行应用程序。这是我的问题:

C:\ webapp \ mcs> jruby -S glassfish

在开发环境中启动GlassFish服务器:0.0.0.0:3000 ... 将日志消息写入:C:/webapp/mcs/log/development.log。 按Ctrl + C停止。

java/util/ServiceLoader.java:207:in `fail': java.util.ServiceConfigurationError: com.sun.enterprise.module.bootstrap.Pla
tformMain: Provider com.sun.enterprise.glassfish.bootstrap.ASEmbedded could not be instantiated: java.lang.IllegalArgume
ntException: URI is not hierarchical (NativeException)
        from java/util/ServiceLoader.java:164:in `access$100'
        from java/util/ServiceLoader.java:353:in `next'
        from java/util/ServiceLoader.java:421:in `next'
        from org/glassfish/api/embedded/Server.java:644:in `getMain'
        from org/glassfish/api/embedded/Server.java:263:in `<init>'
        from org/glassfish/api/embedded/Server.java:61:in `<init>'
        from org/glassfish/api/embedded/Server.java:158:in `build'
        from org/glassfish/api/embedded/Server.java:140:in `build'
        from org/glassfish/scripting/gem/GlassFishMain.java:122:in `startGlassFishEmbedded'
        from org/glassfish/scripting/gem/GlassFishMain.java:298:in `start'
        from c:/jruby-1.5.6/lib/ruby/gems/1.8/gems/glassfish-1.0.2-universal-java/lib/server.rb:146:in `start'
        from c:/jruby-1.5.6/lib/ruby/gems/1.8/gems/glassfish-1.0.2-universal-java/lib/server.rb:146:in `start'
        from C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/glassfish-1.0.2-universal-java/bin/glassfish:55
        from C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/glassfish-1.0.2-universal-java/bin/glassfish:19:in `load'
        from c:/jruby-1.5.6/bin/glassfish:19

我确定这是一个简单的环境设置,有什么建议吗?非常感谢。

3 个答案:

答案 0 :(得分:2)

我要谈谈1.0.3.beta.1代码。如上所述,错误类似,但我怀疑它们是同一问题的不同表现形式。

Glassfish gem依靠akuma库(http://java.net/projects/akuma/)进入后台。如果您尝试使用JRuby加载它,则会收到如下错误消息:

NameError: cannot link Java class com.sun.akuma.CLibrary, probable missing dependency: Unable to load library 'c': The specified module could not be found.

    from org/jruby/javasupport/JavaClass.java:1054:in `for_name'
    from org/jruby/javasupport/JavaUtilities.java:34:in `get_proxy_class'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/object.rb:46:in `java_import'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/gems/1.8/gems/glassfish-1.0.3.beta.1-universal-java/lib/server.rb:56:in `(class Server)'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/gems/1.8/gems/glassfish-1.0.3.beta.1-universal-java/lib/server.rb:53:in `(class GlassFish)'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/gems/1.8/gems/glassfish-1.0.3.beta.1-universal-java/lib/server.rb:52:in `(root)'
    from org/jruby/RubyKernel.java:1041:in `require'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/gems/1.8/gems/glassfish-1.0.3.beta.1-universal-java/lib/server.rb:31:in `require'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/gems/1.8/gems/glassfish-1.0.3.beta.1-universal-java/lib/glassfish.rb:2:in `(root)'
    from org/jruby/RubyKernel.java:1041:in `require'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/gems/1.8/gems/glassfish-1.0.3.beta.1-universal-java/lib/glassfish.rb:36:in `require'
    from (irb):2:in `evaluate'
    from org/jruby/RubyKernel.java:1091:in `eval'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/1.8/irb.rb:158:in `eval_input'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/1.8/irb.rb:271:in `signal_status'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/1.8/irb.rb:155:in `eval_input'
    from org/jruby/RubyKernel.java:1416:in `loop'
    from org/jruby/RubyKernel.java:1194:in `rbCatch'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/1.8/irb.rb:154:in `eval_input'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/1.8/irb.rb:71:in `start'
    from org/jruby/RubyKernel.java:1194:in `rbCatch'
    from c:/Users/asari/Documents/Development/jruby/lib/ruby/1.8/irb.rb:70:in `start'

您看到JNA无法加载“C”库。我不确定为什么会这样。

答案 1 :(得分:1)

我遇到了运行rails 3.0.3应用程序的相同问题,其中包含以下每个设置:

这些不起作用:

windows,jruby-1.6.0.RC1,glassfish-1.0.3.beta.1-universal-java

windows,jruby-1.6.0.RC1,glassfish-1.0.3-universal-java

windows,jruby-1.6.0.RC1,glassfish-1.0.2-universal-java

windows,jruby-1.5.6,glassfish-1.0.3.beta.1-universal-java

windows,jruby-1.5.6,glassfish-1.0.2-universal-java

windows,jruby-1.5.3,glassfish-1.0.3.beta.1-universal-java

此设置适用于:

windows,jruby-1.5.3,glassfish-1.0.2-universal-java

jjnevis说它适用于jruby-1.5.5和glassfish 1.0.2,所以不太确定它是否是jruby 1.5.5和1.5.6之间引入的bug或1.0.2之间的glassfish gem中引入的bug和1.0.3。但希望这可以帮助其他人指出它...我要去睡觉抱歉..明天可能再看看它

答案 2 :(得分:0)

我通过简单地退回到jruby-1.5.5来完成这项工作。我打算做一篇关于我如何全部运行的博客文章,因为它有点像一场噩梦,但它现在似乎确实在一起。我的设置是:

windows server 2003 R2,rails 3.0.3,jruby 1.5.5,glassfish gem 1.0.2

注意:我认为这个解决方案解决了jruby-1.5.6中的问题,但是在编译的发行版中还没有解决,所以我决定退出: https://github.com/jruby/jruby/commit/621bce3056f71cc9cd0e1b8aa59cecae1fc15e45