Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 8u60: cannot load Java class com.sun.javafx.Logging #95

Closed
oreoshake opened this issue Aug 21, 2015 · 10 comments
Closed

Java 8u60: cannot load Java class com.sun.javafx.Logging #95

oreoshake opened this issue Aug 21, 2015 · 10 comments

Comments

@oreoshake
Copy link
Contributor

[Neils-MacBook-Pro-2 myjrubyfx (master)]$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
[Neils-MacBook-Pro-2 myjrubyfx (master)]$ rake reflect
touch lib/jrubyfx/core_ext/precompiled.rb
touch lib/jrubyfx/dsl_map.rb
touch lib/jrubyfx/imports.rb
Done Writing jrfx!
[Neils-MacBook-Pro-2 myjrubyfx (master)]$ gem build jrubyfx.gemspec
WARNING:  open-ended dependency on rake (>= 0, development) is not recommended
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 0'
WARNING:  open-ended dependency on rspec (>= 0, development) is not recommended
  if rspec is semantically versioned, use:
    add_development_dependency 'rspec', '~> 0'
WARNING:  open-ended dependency on jrubyfx-fxmlloader (>= 0.4) is not recommended
  if jrubyfx-fxmlloader is semantically versioned, use:
    add_runtime_dependency 'jrubyfx-fxmlloader', '~> 0.4'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: jrubyfx
  Version: 1.1.1
  File: jrubyfx-1.1.1-java.gem
[Neils-MacBook-Pro-2 myjrubyfx (master *=)]$ gem install jrubyfx-1.1.1-java.gem
Successfully installed jrubyfx-1.1.1-java
1 gem installed
[Neils-MacBook-Pro-2 myjrubyfx (master)]$ ruby samples/contrib/concurrency_demos/service_demo.rb
NameError: cannot load Java class com.sun.javafx.Logging
          for_name at org/jruby/javasupport/JavaClass.java:204
   get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
       java_import at file:/Users/neilmatatall/.rvm/rubies/jruby-1.7.21/lib/jruby.jar!/jruby/java/core_ext/object.rb:27
               map at org/jruby/RubyArray.java:2412
       java_import at file:/Users/neilmatatall/.rvm/rubies/jruby-1.7.21/lib/jruby.jar!/jruby/java/core_ext/object.rb:22
            (root) at /Users/neilmatatall/.rvm/gems/jruby-1.7.21/gems/jrubyfx-fxmlloader-0.4-java/lib/jrubyfx-fxmlloader.rb:39
           require at org/jruby/RubyKernel.java:1040
           require at /Users/neilmatatall/.rvm/rubies/jruby-1.7.21/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54
            (root) at /Users/neilmatatall/.rvm/gems/jruby-1.7.21/gems/jrubyfx-1.1.1-java/lib/jrubyfx/controller.rb:1
           require at org/jruby/RubyKernel.java:1040
           require at /Users/neilmatatall/.rvm/rubies/jruby-1.7.21/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54
            (root) at /Users/neilmatatall/.rvm/gems/jruby-1.7.21/gems/jrubyfx-1.1.1-java/lib/jrubyfx/controller.rb:21
            (root) at file:/Users/neilmatatall/.rvm/rubies/jruby-1.7.21/lib/jruby.jar!/jruby/kernel19/kernel.rb:1
           require at org/jruby/RubyKernel.java:1040
  require_relative at file:/Users/neilmatatall/.rvm/rubies/jruby-1.7.21/lib/jruby.jar!/jruby/kernel19/kernel.rb:24
            (root) at samples/contrib/concurrency_demos/service_demo.rb:37
@byteit101
Copy link
Member

aww... the private classes changed. This is excuse enough to re-do this. Unfortunately I will likely be rather busy until next week.

@oreoshake
Copy link
Contributor Author

I'm glad to take a stab at it if there's any prior art.

@byteit101
Copy link
Member

Not really. I am planning on doing 2 pass. Instead of converting the fxmlloader to ruby, first pass will be to scan the fxml file for fx:id's and controller methods, then generate a ruby class with those and create a jvm class from that, then pass the generated jvm class back to the original fxmlloader. Its less flexible yes, but will likely have fewer bugs

@oreoshake
Copy link
Contributor Author

That sounds ✨ to me.

I've had issues where building elements in a background thread can sometimes produce invalid ruby in .jruby_cache files. Running on the main thread fixes this (I have a function that loads up dummy versions of the layouts at load time just to compile safely). Do you think your strategy will fix this issue too? If not, I think I can create a reproducible test case.

@byteit101
Copy link
Member

building on the background thread is undefined, and will continue to be so as that is how javafx works. Suprised its actually working at all for you, I usually get "can't build on non-ui thread" exceptions from within javafx. my strategy will be much faster than it is currently and will hopefully cache so background threading should not be an issue anymore

@oreoshake
Copy link
Contributor Author

I can "build" on a non-ui thread (so long as the jruby_cache element is built), but I can't modify the UI on the non-ui thread - and it throws a very obvious error. So threads that contain run_laters when I need to add/update/remove UI elements basically.

@michael-taylor
Copy link

As a work-around, I removed the com.sun.javafx.Logging line from the java_import statement in jrubyfx-fxmlloader.rb and it seems to work.

@ghost
Copy link

ghost commented Oct 1, 2015

btw @michael-taylor's work around seems to work for me as well. No other issues encountered AFAICT

@byteit101
Copy link
Member

Rewrite dependant upon jruby/jruby#3366

@byteit101
Copy link
Member

byteit101/JRubyFX-FXMLLoader@41bb477 fixes this for the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants