Comments (10)
Further: mizuno works fine both with rackup command or mizuno command directly.
from fishwife.
I don't think mizuno sets up logging in any similar way. I can't reproduce this, yet. I upgraded to jruby 9.1.17. My best guess is that somewhere your are loading an incompatible version of SLF4J jar prior to fishwife trying to load rjack-logback gem and rjack-slf4j (packaging its own version of that jar.) There may have been later releases of these that are incompatible with, ahead of the rjack-logback/slf4j versions?
Does your loading jruby-jars end up doing that? Why do you need that?
from fishwife.
Please provide a minimal, self contained, reproducible case. For example, you could start with the fishwife (source tree) example/config.ru and modify until it fails in the same way.
from fishwife.
@dekellum
I used 2 files to re-pro this problem, Gemfile & config.ru:
Gemfile:
source 'https://rubygems.org'
gem 'cuba'
gem 'fishwife', :platforms => :jruby
gem 'rjack-logback', :platforms => :jruby
config.ru:
require 'bundler/setup'
Bundler.require(:default)
if defined?(Fishwife) && defined?(RJack::Logback)
RJack::Logback.config_console( :stderr => true, :thread => true )
end
Cuba.define do
on root do
res.write '<h1>Hello, world!</h1>'
end
end
run Cuba
Generated Gemfile.lock with bundler:
GEM
remote: https://rubygems.org/
specs:
cuba (3.9.2)
rack (>= 1.6.0)
fishwife (1.10.0-java)
rack (>= 1.6.4, < 2.1)
rjack-jetty (>= 9.2.11, < 9.5)
rjack-slf4j (~> 1.7.2)
rack (2.0.5)
rjack-jetty (9.4.6.0-java)
rjack-logback (1.9.0-java)
rjack-slf4j (~> 1.7.16)
rjack-slf4j (1.7.25.0-java)
PLATFORMS
java
DEPENDENCIES
cuba
fishwife
rjack-logback
BUNDLED WITH
1.16.2
Behavior:
fishwife
commands falls back to WEBrick silently.rackup
orrackup -s Fishwife
produces load error exactly as my first post above.
If I remove rjack-logback
gem from Gemfile, then the behavior changes as:
rackup
orfishwife
falls back to WEBrick silently.rackup -s Fishwife
freezes after these lines below:
stone$ rackup -s Fishwife
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Environment:
bogon: ~/tmp/fishwife.test ]
stone$ jruby -v
jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [darwin-x86_64]
bogon: ~/tmp/fishwife.test ]
stone$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
bogon: ~/tmp/fishwife.test ]
stone$
@ macOS 10.12.6
from fishwife.
When you say "freezes", is your server just running but without console logging (given logging setup failed)? In your original report:
Gem Load Error is: failed to coerce org.slf4j.helpers.NOPLoggerFactory to ch.qos.logback.core.Context
Isn't reproduced in your minimized case?
I'm not familiar with cuba gem, can your factor that out as well, and still repro (e.g. simple rack app)?
Also you might try jruby -S bundle exec fishwife config.ru
(just to be certain of env) and removing the bundler/setup and Bundler.require from your config.ru?
from fishwife.
I tested again with dead simple Gemfile/config.ru, and the result is exactly same as in my previous post, while I do found a mistake I wrote. When I said 'freeze', the server actually worked, I was misled because every other rack handler will report the ip-address and/or port it listens on, while fishwife doesn't output anything like that. I'll repeat the result here for clear reading, and with additional test result of bundle exec
case (removing the bundler/setup
and Bundler.require
):
- with rjack-logback gem:
rackup
orrackup -s Fishwife
produces load error on gem 'rjack-logback'fishwife
falls back to WEBrickjruby -S bundle exec fishwife config.ru
(without thebundler/setup
andBundler.require
) falls back to WEBrick
- without rjack-logback gem:
rackup
orfishwife
comes up with WEBrickrackup -s Fishwife
: works (with NOP logger implementation, though)jruby -S bundle exec fishwife config.ru
(without thebundler/setup
andBundler.require
) falls back to WEBrick
Gemfile:
source 'https://rubygems.org'
gem 'fishwife', :platforms => :jruby
gem 'rjack-logback', :platforms => :jruby
config.ru
require 'bundler/setup'
Bundler.require(:default)
if defined?(Fishwife) && defined?(RJack::Logback)
RJack::Logback.config_console( :stderr => true, :thread => true )
end
run proc { |env| [200, {}, ['<h1>hello, world!</h1>'] ] }
Gemfile.lock (produced with gem 'rjack-logback')
GEM
remote: https://rubygems.org/
specs:
fishwife (1.10.0-java)
rack (>= 1.6.4, < 2.1)
rjack-jetty (>= 9.2.11, < 9.5)
rjack-slf4j (~> 1.7.2)
rack (2.0.5)
rjack-jetty (9.4.6.0-java)
rjack-logback (1.9.0-java)
rjack-slf4j (~> 1.7.16)
rjack-slf4j (1.7.25.0-java)
PLATFORMS
java
DEPENDENCIES
fishwife
rjack-logback
BUNDLED WITH
1.16.2
Gemfile.lock (without gem 'rjack-logback')
GEM
remote: https://rubygems.org/
specs:
fishwife (1.10.0-java)
rack (>= 1.6.4, < 2.1)
rjack-jetty (>= 9.2.11, < 9.5)
rjack-slf4j (~> 1.7.2)
rack (2.0.5)
rjack-jetty (9.4.6.0-java)
rjack-slf4j (1.7.25.0-java)
PLATFORMS
java
DEPENDENCIES
fishwife
BUNDLED WITH
1.16.2
from fishwife.
OK, I'm able to reproduce both of the two issues you are seeing. Firstly regarding WEBrick being run from the fishwife
command: It appears that somewhere >= rack 2.0 it has become necessary to use the -s Fishwife
(or --server) flag on the fishwife
command line to get Fishwife
to actually load. Note this can also be added to the config.ru, as the following initial line:
#\ -s Fishwife
Alternatively if you add a dependency for rack ~> 1.6.4
(currently resolves to 1.6.10) then that flag is not required. I'm not sure what has changed (last I looked, rack hasn't maintained a changelog) and testing with rack 2 has been limited here. It would be desirable to fix that in a way that continues to support rack 1.6.
Regarding the other logging initialization issue when using rackup
, rjack-logback needs to be loaded and configured before the first log line is written (during jetty startup). That is a feature of the fact that the SLF4J output impl. binding happens in the java classpath. Modifying your config.ru, while still preserving its ability to run on MRI ruby:
if RUBY_PLATFORM =~ /java/
require 'rjack-logback'
RJack::Logback.config_console( :stderr => true, :thread => true )
end
run proc { |env| [200, {}, ['<h1>hello, world!</h1>'] ] }
This works with jruby -S bundle exec rackup -s Fishwife
.
So there are workarounds for both issues and some potential fixes can be made to make it harder to encounter these in the first place.
from fishwife.
ffcfe5c fixes the need for fishwife -s Fishwife
with rack 2.x.
from fishwife.
confirmed. thank u very much.
from fishwife.
released to rubygems as fishwife 1.10.1
from fishwife.
Related Issues (9)
- Rack 2.x support HOT 3
- Configuration of jetty? HOT 1
- Is async supported? HOT 6
- java.lang.NoSuchMethodError on Jruby 9.3.3.0 nightly build HOT 3
- rack.input does not rewind HOT 7
- fishwife and sinatra 1.4.x mangled content HOT 8
- logging configuration, defaults & documentation HOT 3
- :async in fishwife HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fishwife.