Skip to content

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

@drbobbeaty

Description

@drbobbeaty

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions