开发者

glassfish gem fails to start on windows

I'm trying to run a rails 3 app on a windows server using jruby and glassfish gem. I can run the app fine using "rails s". Here's my probelm:

C:\webapp\mcs>jruby -S glassfish

Starting GlassFish server at: 0.0.0.0:3000 in development environment... Writing log messages to: C:/webapp/mcs/log/development.log. Press Ctrl+C to stop.

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

I'm sure it's a simple environment setup thing, any suggestions? Much appreciated.


I'm going to talk about the 1.0.3.beta.1 code. As mentioned, the error is similar,but I suspect they are different manifestations of the same issue.

Glassfish gem relies on akuma library ( http://java.net/projects/akuma/ ) to go into the background. If you tried to load this it with JRuby, you get the error messages like these:

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'

You see that JNA cannot load the "C" library. I'm not sure why that is.


I ran into the same issue running a rails 3.0.3 app with each of these setups:

These don't work:

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

This setup worked tho:

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

jjnevis says it works on jruby-1.5.5 and glassfish 1.0.2 as well so not quite sure if it's a bug introduced between jruby 1.5.5 and 1.5.6 or a bug introduced in the glassfish gem between 1.0.2 and 1.0.3. But hopefully that helps someone else pin point it down.. I'm headed to bed sorry.. Might have another look at it tomorrow


I got this working by simply backing out to jruby-1.5.5. I intend to do a blog post on how I got this all running, because it was a bit of a nightmare, but it does appear to be holding together at the moment. my setup is:

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

NOTE: I think this fix solves the problem in jruby-1.5.6 but not yet in the compiled distro, so I just decided to back out: https://github.com/jruby/jruby/commit/621bce3056f71cc9cd0e1b8aa59cecae1fc15e45

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜