victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
victori has joined #jruby
ur5us_ has quit [Ping timeout: 260 seconds]
NightMonkey has quit [Quit: ZNC - http://znc.in]
NightMonkey has joined #jruby
ur5us_ has joined #jruby
ur5us_ has quit [Ping timeout: 264 seconds]
ur5us_ has joined #jruby
Caerus has quit [Ping timeout: 260 seconds]
Caerus has joined #jruby
Specialist has joined #jruby
ur5us_ has quit [Ping timeout: 264 seconds]
Specialist has quit [Quit: No Ping reply in 180 seconds.]
Specialist has joined #jruby
satyanash has quit [*.net *.split]
satyanash has joined #jruby
<boc_tothefuture[> I am trying to figure out why I get this error.
<boc_tothefuture[> <main> at /Users/boc@us.ibm.com/personal/openhab-3/conf/automation/lib/ruby/core/dsl/monkey_patch/things.rb:9
<boc_tothefuture[> NameError: cannot load Java class org.openhab.core.thing.internal.ThingImpl
<headius[m]> good morning
<boc_tothefuture[> NameError: cannot load Java class org.openhab.core.thing.internal.ThingImpl
<boc_tothefuture[> I am trying to figure out why I get this error:
<boc_tothefuture[> good morning :-)
<boc_tothefuture[> From this code here:
<boc_tothefuture[> class Java::OrgOpenhabCoreThingInternal::ThingImpl
<headius[m]> hmm NameError would seem to indicate it can't find the class, but sometimes we misinterpret classloading errors
<boc_tothefuture[> So, what seems odd is if I put this piece of code above teh class statement, it works.
<boc_tothefuture[> $things.get(Java::OrgOpenhabCoreThing::ThingUID.new('astro:sun:home'))
<boc_tothefuture[> That goes and grabs a ThingImpl from a registry that tracks them in a global variable.
<headius[m]> fwiw that CamelCase package layout is not recommended... you can use the plain lowercase name with :: instead of . and we don't have to parse and guess at capitalization
<headius[m]> Java::com::ope
<headius[m]> openhabetc
<boc_tothefuture[> ok.. let me colon it up.
<headius[m]> it probably won't help but just a better pattern to use
<boc_tothefuture[> you are recommending this:
<boc_tothefuture[> class Java::org::openhab::core::thing::internal::ThingImpl
<headius[m]> hmmm
<headius[m]> yeah
<headius[m]> Java::com.openhab.core .... is equivalent as well
<boc_tothefuture[> Ok, so, that didn't help. but if I put a puts here, let me show you waht I get.
<boc_tothefuture[> org.openhab.core.thing.internal.ThingImpl@d679512f
<boc_tothefuture[> so with the get, it works.. and the class can be found.
<boc_tothefuture[> Just trying to figure out.. why doing a get.. loads the class and then it can be found?
<boc_tothefuture[> If the get doesn't pull back an object (the lookup fails) I do get the error. So it is like JRuby can't load the class unless its already pulled in somehow? This is the first I am seeing this.
<boc_tothefuture[> would a java_import make a difference?
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
victori has joined #jruby
<boc_tothefuture[> no, no it would not.
<headius[m]> yeah strange
<headius[m]> how are you pulling that library in? requiring a jar?
<boc_tothefuture[> no idea.... Part of a large OSGI project running in apache karaf.. bundles get loaded, etc..
<headius[m]> ok we'll just say it is complicated then
<boc_tothefuture[> :-)
<boc_tothefuture[> I can get what I need to do by monkey patching the object rather than the class..
<headius[m]> if you can pass -d to JRuby we may see more output from the NameError
<boc_tothefuture[> so I have a workaround, but its odd.
<boc_tothefuture[> well its JSR233.. So what property do you want passed?
<headius[m]> also -Xbacktrace.style=full will show us where in Java support it is erroring and maybe we are incorrectly swallowing some other error there
<headius[m]> hmm checking
<headius[m]> jruby.cli.debug
<boc_tothefuture[> anything else or just that one?
<boc_tothefuture[> that didn't make a big difference...
<boc_tothefuture[> I just get the error 3x now?
<headius[m]> some of that may be internal errors we expect and swallow to fall back on other logic
<headius[m]> just gist what you see around the NameError in question that might be relevant
<boc_tothefuture[> the code? or just the error?
<boc_tothefuture[> Any other settings to provide more info?
<boc_tothefuture[> Exception `NameError' at /Users/<user>/personal/openhab-3/conf/automation/lib/ruby/core/dsl/monkey_patch/things.rb:14 - cannot load Java class org.openhab.core.thing.internal.ThingImpl
<boc_tothefuture[> Exception `NameError' at /Users/<user>/personal/openhab-3/conf/automation/lib/ruby/core/dsl/monkey_patch/things.rb:14 - cannot load Java class org.openhab.core.thing.internal.ThingImpl
<boc_tothefuture[> Exception `NameError' at /Users/<user>/personal/openhab-3/conf/automation/lib/ruby/core/dsl/monkey_patch/things.rb:14 - cannot load Java class org.openhab.core.thing.internal.ThingImpl
<boc_tothefuture[> iw what I see
<headius[m]> cannot load Java class, hmm
<headius[m]> jruby.backtrace.style=full
<headius[m]> will show where the exception gets raised in JRuby
<headius[m]> pretty sure this will turn out to b
<headius[m]> be a classloader problem
<headius[m]> gotta figure out how to eliminate those useless stack trace lines at the top 🤔
<headius[m]> ok looking into it
<headius[m]> bleh, of course this path does not have debug logging
<headius[m]> it does appear to be a ClassNotFound exception though
<headius[m]> hmm I think we could unwrap this and get that original error
<headius[m]> with a bit of JRuby pixie dust
<headius[m]> boc_tothefuture: that should work for your case and show us a bit more info about the ClassNotFoundException
<boc_tothefuture[> ok.. let me try it.
<headius[m]> hmm doesn't add much to the story
<headius[m]> ok I see your line of code up there access a different class
<headius[m]> Java::OrgOpenhabCoreThing::ThingUID
<headius[m]> Perhaps this ThingUID is loading in more code itself that causes ThingImpl to get loaded?
<headius[m]> I do not know how your app is structured, but from what we have seen it seems like ThingImpl is simply not available to JRuby before passing through that ThingUID class, which tells me that ThingUID or some code it calls is loading additional stuff
<headius[m]> logging classloading around the error might tell us something, like JVM flag -verbose:class with and without the line that makes it work
<headius[m]> that should at least show the sequence of classes being loaded and maybe tell us why accessing ThingUID constructor causes ThingImpl to be available
<headius[m]> I assume you are opening this class to add some Ruby features
<boc_tothefuture[> Well, the ThinkUID doesn't matter.. because if I put in a non-existant UID it doens't work. It only works if that method brings back a working ThingImpl
<headius[m]> right, so it is causing ThingImpl to be accessi
<headius[m]> accessible
<boc_tothefuture[> ThingImpl implements the Thing interface.. Could I add method_missing on the interface?
<headius[m]> like it is loading in some additional jar or component or classloader and then the class becomes available
<headius[m]> I think that would work, yes
<boc_tothefuture[> it is marked as internal so maybe its not loaded in some weird way by the OSGI system.
<headius[m]> m_m is tweaky sometimes but you should be able to decorate the interface with Ruby stuff rather than decorating the Impl
<boc_tothefuture[> how would that look? would it just be a module?
<boc_tothefuture[> I tried with "class" which didn't work because its an interface.
<headius[m]> module Java::path::to::Thing
<boc_tothefuture[> ok.. let me try that.
<headius[m]> yeah we map interfaces as modules
<boc_tothefuture[> that seems to work.
<boc_tothefuture[> must just be an odd class loading situation
<headius[m]> ok cool
<headius[m]> yeah hard to say but OSGI does a lot of stuff
<headius[m]> nice, travis folks got back to us and bumped up concurrency to 20 to match what we had on .org
<headius[m]> hopefully this also means we will not run into paid limits
travis-ci has joined #jruby
<travis-ci> jruby/jruby (master:1eb511b by Charles Oliver Nutter): The build has errored. https://travis-ci.com/jruby/jruby/builds/201858809 [201 min 58 sec]
travis-ci has left #jruby [#jruby]
<headius[m]> hmm
<headius[m]> bleh jdk download fail again
travis-ci has joined #jruby
<travis-ci> jruby/jruby (master:1eb511b by Charles Oliver Nutter): The build was canceled. https://travis-ci.com/jruby/jruby/builds/201858809 [200 min 34 sec]
travis-ci has left #jruby [#jruby]
travis-ci has joined #jruby
<travis-ci> jruby/jruby (load_service_redux:da77d69 by Charles Oliver Nutter): The build is still failing. https://travis-ci.com/jruby/jruby/builds/201863882 [206 min 40 sec]
travis-ci has left #jruby [#jruby]
ur5us_ has joined #jruby
travis-ci has joined #jruby
travis-ci has left #jruby [#jruby]
<travis-ci> jruby/jruby (load_service_redux:83c0420 by Charles Oliver Nutter): The build has errored. https://travis-ci.com/jruby/jruby/builds/201872182 [213 min 43 sec]
<headius[m]> jeremyevans: something change with sequel build on master?
<jeremyevans> headius[m]: Yes, the gemfile got renamed to .ci.gemfile, since I moved most of the CI to GitHUB Actions
<headius[m]> ok I will make that change in our sequel build script
<headius[m]> if you were to maintain such a script it would be cleaner than us trying to duplicate your travis script, fwiw
<jeremyevans> I think the rake task was renamed from spec_travis to spec_ci as well
<headius[m]> I basically just duplicated your travis job as a script
<jeremyevans> headius[m]: Is it possible you could put the script stuff in the Rakefile?
<jeremyevans> I'm not against a jruby-ci specific rake task
subbu is now known as subbu|away
<jeremyevans> I have to run now, but if a rake task will work, can you send a pull request to Sequel to add a rake task for the jruby CI?
<headius[m]> that's fair, will do
subbu|away is now known as subbu
ur5us_ has quit [Ping timeout: 260 seconds]