JopensslService stream is null in Glassfish
I'm trying to use a rails 4 application warified in glassfish, but it doesn't seem to work.
Exception loading extension `JopensslService`: java.lang.IllegalStateException: Stream handler unavailable due to: null from org/jruby/RubyKernel.java:1065:in `require' from classpath:/META-INF/jruby.home/lib/ruby/shared/jopenssl/load.rb:14:in `(root)' from org/jruby/RubyKernel.java:1065:in `require' from classpath:/META-INF/jruby.home/lib/ruby/shared/openssl.rb:1:in `(root)' from org/jruby/RubyKernel.java:1065:in `require' from classpath:/META-INF/jruby.home/lib/ruby/shared/openssl.rb:1:in `(root)' from org/jruby/RubyKernel.java:1065:in
Any ideas what's going on?. Operating system is windows, glassfish 4.0 and jdk7. It works fine in development (a different machine) running from a folder, but the war file doesn't work in glassfish.
I'm completely new to jruby, I usually hang out in the MRI world on linux with puma as a server, this was my attempt to get something 'windows' friendly.
which jruby version do you use ? how did you warify your app ? could you try it on linux (could be a windows only problem) ?
jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_07-b10 [Windows 7-amd64]
Warified with
warble
also with
warble runnable war
Same outcome.
I've switched to Jboss/Widlfly and the issue doesn't occur... So I'm not sure whether that's a warbler bug or perhaps more of a glassfish bug, but its erroring out with ruby code.
Same here, trying to deploy Redmine 2.5 into Glassfish 3. The logs show this:
--- System
jruby 1.7.13 (1.9.3p392) 2014-06-24 43f133c on Java HotSpot(TM) 64-Bit Server VM 1.7.0_60-b19 [linux-amd64]
Time: 2014-08-18 17:06:37 +0200
Server: GlassFish Server Open Source Edition 3.1.2.2
jruby.home: classpath:/META-INF/jruby.home
--- Context Init Parameters:
com.sun.faces.forceLoadConfiguration = true
com.sun.faces.validateXml = true
public.root = /
rails.env = production
--- Backtrace
LoadError: Exception loading extension `JopensslService`: java.lang.IllegalStateException: Stream handler unavailable due to: null
require at org/jruby/RubyKernel.java:1065
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
load_dependency at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
(root) at classpath:/META-INF/jruby.home/lib/ruby/shared/jopenssl/load.rb:18
require at org/jruby/RubyKernel.java:1065
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
load_dependency at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
(root) at classpath:/META-INF/jruby.home/lib/ruby/shared/openssl.rb:1
require at org/jruby/RubyKernel.java:1065
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
load_dependency at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
(root) at classpath:/META-INF/jruby.home/lib/ruby/shared/openssl.rb:1
require at org/jruby/RubyKernel.java:1065
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
load_dependency at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236
require at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251
(root) at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/rack-1.4.5/lib/rack/session/cookie.rb:1
const_get at org/jruby/RubyModule.java:2638
(root) at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/rack-1.4.5/lib/rack/session/cookie.rb:1
(root) at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/actionpack-3.2.19/lib/action_dispatch/middleware/session/cookie_store.rb:1
tap at org/jruby/RubyKernel.java:1873
(root) at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/actionpack-3.2.19/lib/action_dispatch/middleware/session/cookie_store.rb:4
(root) at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/application/configuration.rb:1
session_store at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/application/configuration.rb:140
instance_exec at org/jruby/RubyBasicObject.java:1562
run at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/initializable.rb:30
default_middleware_stack at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/application.rb:281
each at org/jruby/RubyArray.java:1613
default_middleware_stack at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/application.rb:245
app at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/engine.rb:474
Finisher at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/application/finisher.rb:31
run_initializers at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/initializable.rb:55
require at org/jruby/RubyKernel.java:1065
run_initializers at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/initializable.rb:54
initialize! at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/application.rb:136
method_missing at /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30
--- RubyGems
Gem.dir: /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems
Gem.path:
/opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems
Activated gems:
bundler-1.7.0
rake-10.3.2
i18n-0.6.11
multi_json-1.10.1
activesupport-3.2.19
builder-3.0.4
activemodel-3.2.19
erubis-2.7.0
journey-1.0.4
rack-1.4.5
rack-cache-1.2
rack-test-0.6.2
hike-1.2.3
tilt-1.4.1
sprockets-2.2.2
actionpack-3.2.19
mime-types-1.25.1
polyglot-0.3.5
treetop-1.4.15
mail-2.5.4
actionmailer-3.2.19
arel-3.0.3
tzinfo-0.3.41
activerecord-3.2.19
activerecord-jdbc-adapter-1.3.9
jdbc-postgres-9.3.1102
activerecord-jdbcpostgresql-adapter-1.3.9
activeresource-3.2.19
coderay-1.1.0
fastercsv-1.5.5
rack-ssl-1.3.4
json-1.8.1-java
rdoc-3.12.2
thor-0.19.1
railties-3.2.19
jquery-rails-2.0.3
net-ldap-0.3.1
ruby-openid-2.3.0
rack-openid-1.4.2
rails-3.2.19
request_store-1.0.5
--- Bundler
Bundler.bundle_path: /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems
Bundler.root: /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF
Gemfile: /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/Gemfile
Settings:
gemfile = /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/Gemfile
without = development:test:assets
bin_path = /opt/ecdb/glassfish3/glassfish/domains/domain1/applications/redmine/WEB-INF/gems/gems/bundler-1.7.0/bin/bundle
--- JRuby-Rack Config
compat_version =
default_logger = org.jruby.rack.logging.StandardOutLogger@42da70bd
equals = <error: >
err = com.sun.common.util.logging.LoggingOutputStream$LoggingPrintStream@722abd52
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_memory_buffer_size =
initial_runtimes =
jms_connection_factory =
jms_jndi_properties =
logger = org.jruby.rack.logging.ServletContextLogger@694f73c5
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_memory_buffer_size =
maximum_runtimes =
num_initializer_threads =
out = com.sun.common.util.logging.LoggingOutputStream$LoggingPrintStream@1787329e
rackup =
rackup_path =
rewindable = true
runtime_arguments =
runtime_environment =
runtime_timeout_seconds =
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade@7aeab9ef
throw_init_exception = false
Adding this to Redmine's Gemfile fixes the issue for me:
platforms :jruby do
gem "jruby-openssl", "~> 0.8.8"
end
Warble warns with 129 messages like this:
/usr/local/rvm/gems/jruby-1.7.13/gems/jruby-openssl-0.8.10/lib/shared/jruby-openssl.rb:15 warning: already initialized constant OPENSSL_VERSION
But in the end it works...
I have the same problem with glasfish 3.1 and jruby 1.7.18, but the "jruby-openssl", "~> 0.8.8" workaround didn't work for me. It seems open ssl included in jruby is used. Has someone a solution ?
@areman which OS ? windows ?
No, I'm using ubuntu ( in an VMWare on Windows 7 )
jruby-jars 1.7.2 and jruby-openssl 0.8.2 works for me. But I need a up to date jruby version.
The java stacktrace looks like
[#|2015-01-13T10:44:23.033+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=1;_ThreadName=Thread-2;|java.lang.IllegalStateException: Stream handler unavailable due to: null
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.openConnection(URLHandlersStreamHandlerProxy.java:311)
at java.net.URL.openConnection(URL.java:971)
at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:722)
at sun.misc.URLClassPath$JarLoader.access$600(URLClassPath.java:591)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:673)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:666)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:665)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:616)
at sun.misc.URLClassPath$3.run(URLClassPath.java:366)
at sun.misc.URLClassPath$3.run(URLClassPath.java:356)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:355)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:332)
at sun.misc.URLClassPath.findResource(URLClassPath.java:175)
at java.net.URLClassLoader$2.run(URLClassLoader.java:551)
at java.net.URLClassLoader$2.run(URLClassLoader.java:549)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:548)
at org.jruby.util.JRubyClassLoader.findResource(JRubyClassLoader.java:228)
at java.lang.ClassLoader.getResource(ClassLoader.java:1139)
at org.jruby.runtime.load.ClassExtensionLibrary.tryServiceLoad(ClassExtensionLibrary.java:148)
at org.jruby.runtime.load.ClassExtensionLibrary.tryFind(ClassExtensionLibrary.java:76)
at org.jruby.runtime.load.LibrarySearcher$ResourceLibrary.loadJar(LibrarySearcher.java:310)
at org.jruby.runtime.load.LibrarySearcher$ResourceLibrary.load(LibrarySearcher.java:248)
at org.jruby.runtime.load.LibrarySearcher$FoundLibrary.load(LibrarySearcher.java:51)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:917)
at org.jruby.runtime.load.LoadService.smartLoadInternal(LoadService.java:566)
at org.jruby.runtime.load.LoadService.requireCommon(LoadService.java:450)
at org.jruby.runtime.load.LoadService.require(LoadService.java:414)
since jruby 1.7.x jopenssl is included in the jruby. why add a specific jopenssl version helps?
if you provide me the log when you set the java system property 'jruby.debug.loadService' = 'true' then I might be able help or even fix it on jruby side (or warbler side).
glassfish is one of the environments I never installed . . . .
to have such an old jruby-openssl gem not sure how well it works with jruby-1.7.x
in past there were loads of issues with the jruby-openssl gem embedded into jruby, there are still issue but less ;)
I'm using jruby 1.7.18 without additional openssl jars. To force the problem I add a WEB-INF/init.rb file with an require 'jopenssl'
[#|2015-01-24T16:05:04.179+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.179+01:00: LoadService: trying builtinLib: jopenssl.rb|#]
[#|2015-01-24T16:05:04.180+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.180+01:00: LoadService: trying fileResource: /home/amos/sample/common/modules/platform/amos_qt/jopenssl.rb|#]
[#|2015-01-24T16:05:04.181+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.181+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/1.9/site_ruby/jopenssl.rb|#]
[#|2015-01-24T16:05:04.183+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.183+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/shared/jopenssl.rb|#]
[#|2015-01-24T16:05:04.185+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.185+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/1.9/jopenssl.rb|#]
[#|2015-01-24T16:05:04.187+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.187+01:00: LoadService: trying jarExtension: jopenssl|#]
[#|2015-01-24T16:05:04.188+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.188+01:00: LoadService: trying builtinLib: jopenssl.class|#]
[#|2015-01-24T16:05:04.189+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.189+01:00: LoadService: trying fileResource: /home/amos/sample/common/modules/platform/amos_qt/jopenssl.class|#]
[#|2015-01-24T16:05:04.189+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.189+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/1.9/site_ruby/jopenssl.class|#]
[#|2015-01-24T16:05:04.192+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.191+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/shared/jopenssl.class|#]
[#|2015-01-24T16:05:04.193+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.193+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/1.9/jopenssl.class|#]
[#|2015-01-24T16:05:04.195+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.195+01:00: LoadService: trying builtinLib: jopenssl.jar|#]
[#|2015-01-24T16:05:04.196+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.195+01:00: LoadService: trying fileResource: /home/amos/sample/common/modules/platform/amos_qt/jopenssl.jar|#]
[#|2015-01-24T16:05:04.196+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.196+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/1.9/site_ruby/jopenssl.jar|#]
[#|2015-01-24T16:05:04.198+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.198+01:00: LoadService: trying fileResource: classpath:/META-INF/jruby.home/lib/ruby/shared/jopenssl.jar|#]
[#|2015-01-24T16:05:04.206+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|2015-01-24T16:05:04.206+01:00: LoadService: found fileResource: classpath:/META-INF/jruby.home/lib/ruby/shared/jopenssl.jar|#]
[#|2015-01-24T16:05:04.257+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=97;_ThreadName=Thread-2;|java.lang.IllegalStateException: Stream handler unavailable due to: null
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.openConnection(URLHandlersStreamHandlerProxy.java:311)
at java.net.URL.openConnection(URL.java:971)
at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:722)
at sun.misc.URLClassPath$JarLoader.access$600(URLClassPath.java:591)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:673)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:666)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:665)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:616)
at sun.misc.URLClassPath$3.run(URLClassPath.java:366)
at sun.misc.URLClassPath$3.run(URLClassPath.java:356)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:355)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:332)
at sun.misc.URLClassPath.findResource(URLClassPath.java:175)
at java.net.URLClassLoader$2.run(URLClassLoader.java:551)
at java.net.URLClassLoader$2.run(URLClassLoader.java:549)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:548)
at org.jruby.util.JRubyClassLoader.findResource(JRubyClassLoader.java:228)
at java.lang.ClassLoader.getResource(ClassLoader.java:1139)
at org.jruby.runtime.load.ClassExtensionLibrary.tryServiceLoad(ClassExtensionLibrary.java:148)
´´´
this gives more inside. is glassfish using an osgi container under the hood ? at least they use the felix framework their stream-handlers.
could you prepend
$LOAD.unshift 'uri:classloader:/META-INF/jruby.home/lib/ruby/shared'
before requiring openssl. the 'uri:classloader:' does work with felix so there is a chance this solves the glassfish probelm as well.
Yes it seems to work !! My tests are running. I added a WEB-INF/init.rb file with the content
$LOAD_PATH.unshift 'uri:classloader:/META-INF/jruby.home/lib/ruby/shared'
require 'jopenssl'
Thank you !!
cool - since this is default for jruby-9k it good to hear that it removes those problems ;)
@areman
I'm having the same problem, please bear with me as this is my first time using Jruby, rails, warbler and glassfish together. My goal is just to have jruby hello world running on glassfish and i opted using warbler since v4 does not have jruby on glassfish anymore.
So here's what I did,
- create rails application - rails new hello
- added gem 'jruby-openssl' to Gemfile
- do bundle install
- warble -> created hello.war
- deploy hello.war
- getting the same error as yours.
- trying added applications/hello/WEB-INF/init.rb with content $LOAD_PATH.unshift 'uri:classloader:/META-INF/jruby.home/lib/ruby/shared' require 'jopenssl'
- Still getting the same error
What am i missing? is there any steps I need to add before creating hello.war? I did not get any error during creating the .war file or on deployment.
Thanks in advance for your assistance.
jruby comes with jruby-openssl gem bundles there is no need of adding this on the Gemfile. try the same thing without the jruby-openssl gem !
did you try jruby-9.0.0.0.pre2 ? which would not need the WEB-INF/init.rb workaround
@mkristian
I apologize I failed to mention my setup. Here goes: JRuby-1.7.19 - installed as multi-users (I'm not sure if this matters or not) Glassfish 4.1 Ubuntu 14.04 on VPS
First try I just created new rails project and generate controller and a view for the controller followed by creating the .war file, and I did not have jruby-openssl in Gemfile and it generates the same error. Then I added jruby-openssl -> same error. Try to add WEB-INF/init.rb and still getting the same error. .
I will try JRuby 9k and report back. Thank you kristian.
By the way here's the backtrace:
LoadError: load error: jopenssl/load -- java.lang.IllegalStateException: Stream handler unavailable due to: null require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/shared/openssl.rb:1 require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/key_generator.rb:1 require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/key_generator.rb:2 require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/railties-4.2.1/lib/rails/application.rb:1 require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/railties-4.2.1/lib/rails/application.rb:4 require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/railties-4.2.1/lib/rails.rb:1 require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/railties-4.2.1/lib/rails.rb:11 require at org/jruby/RubyKernel.java:1072 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/railties-4.2.1/lib/rails/all.rb:1 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/gems/gems/railties-4.2.1/lib/rails/all.rb:1 (root) at /home/glassfish/glassfish/domains/domain1/applications/hello/WEB-INF/config/application.rb:1
--- JRuby-Rack Config compat_version = default_logger = org.jruby.rack.logging.StandardOutLogger@577541b0 equals = <error: > err = org.apache.felix.gogo.runtime.threadio.ThreadPrintStream@efb0540 filter_adds_html = true filter_verifies_resource = false ignore_environment = false initial_memory_buffer_size = initial_runtimes = 1 jms_connection_factory = jms_jndi_properties = logger = org.jruby.rack.logging.ServletContextLogger@4172fe4
logger_class_name = servlet_context logger_name = jruby.rack maximum_memory_buffer_size = maximum_runtimes = 1 num_initializer_threads = out = org.apache.felix.gogo.runtime.threadio.ThreadPrintStream@4d0c2ba2 rackup = rackup_path = default_logger = org.jruby.rack.logging.StandardOutLogger@577541b0 equals = <error: > err = org.apache.felix.gogo.runtime.threadio.ThreadPrintStream@efb0540 filter_adds_html = true filter_verifies_resource = false ignore_environment = false initial_memory_buffer_size = initial_runtimes = 1 jms_connection_factory = jms_jndi_properties = logger = org.jruby.rack.logging.ServletContextLogger@4172fe4 logger_class_name = servlet_context logger_name = jruby.rack maximum_memory_buffer_size = maximum_runtimes = 1 num_initializer_threads = out = org.apache.felix.gogo.runtime.threadio.ThreadPrintStream@4d0c2ba2 rackup = rackup_path = rewindable = true runtime_arguments = runtime_environment = runtime_timeout_seconds = serial_initialization = false servlet_context = org.apache.catalina.core.ApplicationContextFacade@28ad1655 throw_init_exception = false
.
Another update.
Tried with jruby-1.7.20 and still nada So now I have 3 installation of jruby namely 1.7.19, 1.7.20 and 9.0.0.0.pre 2 all managed by RVM.
I tried run: warble executable war java -jar hello.war
it worked fine.
But I want it to deploy it with glassfish since I already have my other Applications run in glassfish(PHP, AngularJS, JSF)
I noted something that could very well be the problem but I just want to throw it out there see if it's me wasting time because this was not related or this was a stupid mistake.
rey@rey-vps:/usr/share/rvm/examples$ echo $GEM_HOME /usr/share/rvm/gems/jruby-1.7.20
it's pointing to my JRUBY_HOME instead of jruby gems folder, I'm going to bang my head on my table if this was the cause...
well, rvm is setting GEM_HOME which can interfere with java application running jruby unless they explicitly set GEM_HOME to point to standard GEM_HOME from jruby or the "gems" folder of you application.
your stacktrace looks as it is when you did not have WEB-INF/init.rb with the LOAD_PATH fix
I downloaded glassfish4.1 and try to reproduce your problem on my side but for some reason the domain does not start up :(
so you could you do the same as I asked here: https://github.com/jruby/warbler/issues/266#issuecomment-71319808 to set the system property 'jruby.debug.loadService=true'
@renaldi1982 what I did:
created file ./config/warbler.rb
Warbler::Config.new do |config|
config.includes = FileList["init.rb"]
end
and ./init.rb inside the rails root directory
$LOAD_PATH.unshift 'uri:classloader:/META-INF/jruby.home/lib/ruby/shared'
this removed the initial error I did see regarding jopenssl.
Thanks Kristian, I will try to add that and report back here.
EDIT: It's working, thank you very much Kristian! could you clarify the thought process since i'm not familiar with web/app server framework and i'm not sure why what you did work? just the general idea, I will pick up from there. Again thank you very much for your time.
Here's what I got so far:
You created a file in config that define warbler configuration telling warbler to include file init.rb that's located in app root folder, but what does the line in init.rb means?
I have experienced the exact same issue. Given that open ssl is now part of JRuby I experienced the same error (on glassfish) that everyone else did but I seem to have found a much simpler fix. Without doing any of the other stuff I simply added JRuby's complete jar to the domain's extension directory, so in (my case):
C:\work\ETS\glassfish\glassfish4\glassfish\domains\domain1\lib\ext
I added the following jar file:
jruby-complete-9.0.4.0.jar
And that is it!