-
Notifications
You must be signed in to change notification settings - Fork 203
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
NoMethodError: undefined method `new_ostruct_member' for No value for 'public' found #508
Comments
👋 I believe this is connected to ruby/ostruct#40 |
Thanks @olleolleolle 🙏 |
Hope this will resolve soon before the next JRuby release. For the time being, I'll just use 9.3.2.0. For those who use 9.3.2.0, you may run into issues with running tests if you are using Simplecov. (jruby/jruby#6984) Just skip the Simplecov in test_helper.rb file. unless RUBY_ENGINE == 'jruby'
require 'simplecov'
SimpleCov.start 'rails' do
add_filter %r{^/app/channels/}
add_filter %r{^/app/jobs/}
end
end |
We're experiencing the same problem on our application. I think it'd make sense to keep this GH issue open since the issue exists and has not been fixed yet (https://github.com/jruby/warbler/blob/master/lib/warbler/traits/war.rb#L185 still uses the deprecated method). |
Pulled the following from class Warbler::Traits::War::WebxmlOpenStruct
def new_ostruct_member(name)
unless @table.key?(name) || is_method_protected!(name)
getter_proc = Proc.new { @table[name] }
setter_proc = Proc.new {|x| @table[name] = x}
if defined?(::Ractor)
::Ractor.make_shareable(getter_proc)
::Ractor.make_shareable(setter_proc)
end
define_singleton_method!(name, &getter_proc)
define_singleton_method!("#{name}=", &setter_proc)
end
end
end Gross, but seems to work. |
@kovyrin I believe we should just open a new issue for this change (or another) since once there is a new ostruct release warbler should work again. There is nothing directly actionable to be done here (at least not until that deprecated method is actually removed). I definitely agree with you that we need to change this class though. Just as a new issue. Frankly, I did not spend very much time but I find it confusing this is using ostruct at all. It override [], []=, and method_missing. If I look at []= I wonder why this needs to be overriden at all? I am sure there is a reason but we could probably just eliminate this dependency if it actually needs the metaprogramming it already has. |
With this workaround file This means that with default warble configuration Error message from tomcat is something like:
Workaround for that is to uncomment/add line |
I also had to add guard |
Please reopen this issue because the reason is not fixed. |
FWIW, I came up with a simpler and less copy-pasty version of @kovyrin's warble.rb workaround: class Warbler::Traits::War::WebxmlOpenStruct
def new_ostruct_member(name)
send(:new_ostruct_member!, name)
end
end This defines a public alias on Warbler::Traits::War::WebxmlOpenStruct for the private |
On Apple Silicon if I try the fix from @ikaronen-relex or @jlahtinen I get "TypeError: nil is not a string" |
Still seems to be issues here so let's sort that out. |
We're seeing this with 9.3.4.0 as we're trying to upgrade to the 9.3 series. |
It seems there is and additional issue discovered by @joerixaop being |
I fixed this issue with installing warbler directly from GitHub repo instead of "gem install warbler".
|
@rammpeter so perhaps we have fixed this on warbler master but need a release? |
Hi @headius, A new release would be good and greatly appreciated. In my side, warbler is part of our build process and because this issue we are not able to upgrade to JRuby We have
The only pending thing is update the Another thing we might need to look after is the compiler line the
|
Yes, this seems to be the case |
Following @rammpeter's suggestion, I created a working Tomcat 9 app using Sinatra 3.0.5 and JRuby 9.4.0.0 with these two extra steps: Change the
Manually copy |
New release of |
A year and a quarter later, and still not fixed? |
I'm just developing an alternative approach for deploying a Rails application in a self executing jar file (jarbler). Coming soon. |
As mentioned before, for creating a self executing jar file there's an alternative now available with Jarbler ( https://github.com/rammpeter/jarbler ). |
Hello @headius,
I'm just trying to upgrade from 9.2.19.0 to 9.3.3.0. But I could not able to generate the war file and get the error below.
Is there anything do I need to upgrade?
warbler version 2.0.5
JDK openjdk-16.0.1
Many Thanks.
Ted
warble war --trace
The text was updated successfully, but these errors were encountered: