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

Validator can't find draft-03.json when in a Warbler/JRuby jar #47

Open
drbobbeaty opened this issue Oct 22, 2012 · 0 comments · May be fixed by #401
Open

Validator can't find draft-03.json when in a Warbler/JRuby jar #47

drbobbeaty opened this issue Oct 22, 2012 · 0 comments · May be fixed by #401

Comments

@drbobbeaty
Copy link

Set-Up

We are deploying a Ruby app with JRuby (1.6.7.2) and Warbler (1.3.6) as an executable jar. Standard JRuby 1.9 compatibility mode.

Problem

I don't believe that the Validator code is looking within the jar for the draft-03.json metaschema files:

gm14312{bbeaty}504: java -Djruby.compat.version=1.9 -jar quantum-lead/quantum-lead.jar process clevelend
Errno::ENOENT: No such file or directory - /Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/resources/draft-03.json
             initialize at org/jruby/RubyFile.java:465
                   open at org/jruby/RubyIO.java:1135
                   open at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/lib/json-schema/uri/file.rb:27
                   open at file:/var/folders/y0/w6rwlbtx42v8pkf8sfdck27wgfcp7p/T/jruby1681743642137120687extract/jruby-stdlib-1.6.7.2.jar!/META-INF/jruby.home/lib/ruby/1.9/open-uri.rb:33
      initialize_schema at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/lib/json-schema/validator.rb:517
             initialize at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/lib/json-schema/validator.rb:164
         fully_validate at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/lib/json-schema/validator.rb:324
  fully_validate_schema at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/lib/json-schema/validator.rb:331
       validate_schema! at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/contracts.rb:124
       contractual_proc at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/contracts.rb:54
           add_contract at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/contracts.rb:28
                 Client at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/demand/adjustment/client.rb:52
             Adjustment at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/demand/adjustment/client.rb:10
                 Demand at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/demand/adjustment/client.rb:9
                 (root) at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/demand/adjustment/client.rb:8
                require at org/jruby/RubyKernel.java:1042
                require at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/demand/adjustment/client.rb:36
                 (root) at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/demand_etl.rb:4
                require at org/jruby/RubyKernel.java:1042
                require at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/demand_etl.rb:36
                 (root) at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/quantum_lead.rb:1
                require at org/jruby/RubyKernel.java:1042
                require at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/lib/quantum_lead.rb:36
                 (root) at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/bin/process.rb:27
                require at org/jruby/RubyKernel.java:1042
                require at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/bin/process.rb:36
                 (root) at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/bin/quantum-lead.rb:5
                   load at org/jruby/RubyKernel.java:1068
                 (root) at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/quantum-lead/bin/quantum-lead.rb:1
                require at org/jruby/RubyKernel.java:1042
                require at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/META-INF/main.rb:36
                 (root) at <script>:3

The core part of the stack trace is the section:

Errno::ENOENT: No such file or directory - /Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/resources/draft-03.json
             initialize at org/jruby/RubyFile.java:465
                   open at org/jruby/RubyIO.java:1135
                   open at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/lib/json-schema/uri/file.rb:27
                   open at file:/var/folders/y0/w6rwlbtx42v8pkf8sfdck27wgfcp7p/T/jruby1681743642137120687extract/jruby-stdlib-1.6.7.2.jar!/META-INF/jruby.home/lib/ruby/1.9/open-uri.rb:33
      initialize_schema at file:/Users/bbeaty/Developer/quantum-lead/quantum-lead.jar!/gems/json-schema-1.0.10/lib/json-schema/validator.rb:517

because we can see from the last line, the validator.rb file is being referenced from within the jar file, and then when it tries to find the draft-03.json file, it's in the normal filesystem.

It's not going to find the file because we deploy only the jar.

@pd pd mentioned this issue Nov 3, 2014
@Majlen Majlen linked a pull request Nov 1, 2017 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant