FileSystemNotFoundException when init Graal in Springboot












3















I add graal libs in my project to execute JavaScript in Java. My project worked on spingboot framework.



compile group: 'org.graalvm.sdk', name: 'graal-sdk', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js-scriptengine', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'profiler', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'chromeinspector', version: '1.0.0-rc9'
compile group: 'org.graalvm.truffle', name: 'truffle-api', version: '1.0.0-rc9'



  1. If I run my project with "gradle bootRun" or IDEA directly, graal init success and work fine;


  2. If I buid my project to a fat jar, which contains all libs in it, graal init failed and throw a FileSystemNotFoundException.



    java.nio.file.FileSystemNotFoundException: null
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:169)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:155)
    at java.base/java.nio.file.Paths.get(Paths.java:143)
    at com.oracle.truffle.polyglot.LanguageCache.collectLanguages(LanguageCache.java:284)
    at com.oracle.truffle.polyglot.LanguageCache.createLanguages(LanguageCache.java:211)
    at com.oracle.truffle.polyglot.LanguageCache.languages(LanguageCache.java:201)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.initializeLanguages(PolyglotEngineImpl.java:480)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:168)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:152)
    at com.oracle.truffle.polyglot.PolyglotImpl.buildEngine(PolyglotImpl.java:197)
    at org.graalvm.polyglot.Engine$Builder.build(Engine.java:488)
    at org.graalvm.polyglot.Context$Builder.build(Context.java:1083)
    at org.graalvm.polyglot.Context.create(Context.java:660)
    at ocpm.pcf.policyengine.engine.cache.JavaScriptPolicyParser.graalParse(JavaScriptPolicyParser.java:48)



I debug the ponit in exception stack, and found that graal want to init "lauguage" configuration file in js-1.0.0-rc9.jar. But in the above scenarios, it used different URI schema.



 - In the first scenario, the URI is "jar:file:/C:/Users/texu/.gradle/caches/modules-2/files-2.1/org.graalvm.js/js/1.0.0-rc9/25f41dd171dfa5c5921bc1f6bbdf7860279fc43c/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a normal file path; 
- In the second scenario, the URI is "jar:file:/app/policy-engine.jar!/BOOT-INF/lib/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a path of nested jar.


So, how can I init graal in springboot fat jar?










share|improve this question

























  • Yeah, this looks like a bug, I pinged the team, we'll investigate.

    – Oleg Šelajev
    Dec 3 '18 at 15:40
















3















I add graal libs in my project to execute JavaScript in Java. My project worked on spingboot framework.



compile group: 'org.graalvm.sdk', name: 'graal-sdk', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js-scriptengine', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'profiler', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'chromeinspector', version: '1.0.0-rc9'
compile group: 'org.graalvm.truffle', name: 'truffle-api', version: '1.0.0-rc9'



  1. If I run my project with "gradle bootRun" or IDEA directly, graal init success and work fine;


  2. If I buid my project to a fat jar, which contains all libs in it, graal init failed and throw a FileSystemNotFoundException.



    java.nio.file.FileSystemNotFoundException: null
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:169)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:155)
    at java.base/java.nio.file.Paths.get(Paths.java:143)
    at com.oracle.truffle.polyglot.LanguageCache.collectLanguages(LanguageCache.java:284)
    at com.oracle.truffle.polyglot.LanguageCache.createLanguages(LanguageCache.java:211)
    at com.oracle.truffle.polyglot.LanguageCache.languages(LanguageCache.java:201)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.initializeLanguages(PolyglotEngineImpl.java:480)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:168)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:152)
    at com.oracle.truffle.polyglot.PolyglotImpl.buildEngine(PolyglotImpl.java:197)
    at org.graalvm.polyglot.Engine$Builder.build(Engine.java:488)
    at org.graalvm.polyglot.Context$Builder.build(Context.java:1083)
    at org.graalvm.polyglot.Context.create(Context.java:660)
    at ocpm.pcf.policyengine.engine.cache.JavaScriptPolicyParser.graalParse(JavaScriptPolicyParser.java:48)



I debug the ponit in exception stack, and found that graal want to init "lauguage" configuration file in js-1.0.0-rc9.jar. But in the above scenarios, it used different URI schema.



 - In the first scenario, the URI is "jar:file:/C:/Users/texu/.gradle/caches/modules-2/files-2.1/org.graalvm.js/js/1.0.0-rc9/25f41dd171dfa5c5921bc1f6bbdf7860279fc43c/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a normal file path; 
- In the second scenario, the URI is "jar:file:/app/policy-engine.jar!/BOOT-INF/lib/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a path of nested jar.


So, how can I init graal in springboot fat jar?










share|improve this question

























  • Yeah, this looks like a bug, I pinged the team, we'll investigate.

    – Oleg Šelajev
    Dec 3 '18 at 15:40














3












3








3








I add graal libs in my project to execute JavaScript in Java. My project worked on spingboot framework.



compile group: 'org.graalvm.sdk', name: 'graal-sdk', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js-scriptengine', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'profiler', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'chromeinspector', version: '1.0.0-rc9'
compile group: 'org.graalvm.truffle', name: 'truffle-api', version: '1.0.0-rc9'



  1. If I run my project with "gradle bootRun" or IDEA directly, graal init success and work fine;


  2. If I buid my project to a fat jar, which contains all libs in it, graal init failed and throw a FileSystemNotFoundException.



    java.nio.file.FileSystemNotFoundException: null
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:169)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:155)
    at java.base/java.nio.file.Paths.get(Paths.java:143)
    at com.oracle.truffle.polyglot.LanguageCache.collectLanguages(LanguageCache.java:284)
    at com.oracle.truffle.polyglot.LanguageCache.createLanguages(LanguageCache.java:211)
    at com.oracle.truffle.polyglot.LanguageCache.languages(LanguageCache.java:201)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.initializeLanguages(PolyglotEngineImpl.java:480)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:168)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:152)
    at com.oracle.truffle.polyglot.PolyglotImpl.buildEngine(PolyglotImpl.java:197)
    at org.graalvm.polyglot.Engine$Builder.build(Engine.java:488)
    at org.graalvm.polyglot.Context$Builder.build(Context.java:1083)
    at org.graalvm.polyglot.Context.create(Context.java:660)
    at ocpm.pcf.policyengine.engine.cache.JavaScriptPolicyParser.graalParse(JavaScriptPolicyParser.java:48)



I debug the ponit in exception stack, and found that graal want to init "lauguage" configuration file in js-1.0.0-rc9.jar. But in the above scenarios, it used different URI schema.



 - In the first scenario, the URI is "jar:file:/C:/Users/texu/.gradle/caches/modules-2/files-2.1/org.graalvm.js/js/1.0.0-rc9/25f41dd171dfa5c5921bc1f6bbdf7860279fc43c/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a normal file path; 
- In the second scenario, the URI is "jar:file:/app/policy-engine.jar!/BOOT-INF/lib/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a path of nested jar.


So, how can I init graal in springboot fat jar?










share|improve this question
















I add graal libs in my project to execute JavaScript in Java. My project worked on spingboot framework.



compile group: 'org.graalvm.sdk', name: 'graal-sdk', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js', version: '1.0.0-rc9'
compile group: 'org.graalvm.js', name: 'js-scriptengine', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'profiler', version: '1.0.0-rc9'
compile group: 'org.graalvm.tools', name: 'chromeinspector', version: '1.0.0-rc9'
compile group: 'org.graalvm.truffle', name: 'truffle-api', version: '1.0.0-rc9'



  1. If I run my project with "gradle bootRun" or IDEA directly, graal init success and work fine;


  2. If I buid my project to a fat jar, which contains all libs in it, graal init failed and throw a FileSystemNotFoundException.



    java.nio.file.FileSystemNotFoundException: null
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:169)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:155)
    at java.base/java.nio.file.Paths.get(Paths.java:143)
    at com.oracle.truffle.polyglot.LanguageCache.collectLanguages(LanguageCache.java:284)
    at com.oracle.truffle.polyglot.LanguageCache.createLanguages(LanguageCache.java:211)
    at com.oracle.truffle.polyglot.LanguageCache.languages(LanguageCache.java:201)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.initializeLanguages(PolyglotEngineImpl.java:480)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:168)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:152)
    at com.oracle.truffle.polyglot.PolyglotImpl.buildEngine(PolyglotImpl.java:197)
    at org.graalvm.polyglot.Engine$Builder.build(Engine.java:488)
    at org.graalvm.polyglot.Context$Builder.build(Context.java:1083)
    at org.graalvm.polyglot.Context.create(Context.java:660)
    at ocpm.pcf.policyengine.engine.cache.JavaScriptPolicyParser.graalParse(JavaScriptPolicyParser.java:48)



I debug the ponit in exception stack, and found that graal want to init "lauguage" configuration file in js-1.0.0-rc9.jar. But in the above scenarios, it used different URI schema.



 - In the first scenario, the URI is "jar:file:/C:/Users/texu/.gradle/caches/modules-2/files-2.1/org.graalvm.js/js/1.0.0-rc9/25f41dd171dfa5c5921bc1f6bbdf7860279fc43c/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a normal file path; 
- In the second scenario, the URI is "jar:file:/app/policy-engine.jar!/BOOT-INF/lib/js-1.0.0-rc9.jar!/META-INF/truffle/language", which is a path of nested jar.


So, how can I init graal in springboot fat jar?







javascript spring-boot graalvm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 6:02









Vikrant Kashyap

3,60411537




3,60411537










asked Nov 28 '18 at 4:39









texutexu

161




161













  • Yeah, this looks like a bug, I pinged the team, we'll investigate.

    – Oleg Šelajev
    Dec 3 '18 at 15:40



















  • Yeah, this looks like a bug, I pinged the team, we'll investigate.

    – Oleg Šelajev
    Dec 3 '18 at 15:40

















Yeah, this looks like a bug, I pinged the team, we'll investigate.

– Oleg Šelajev
Dec 3 '18 at 15:40





Yeah, this looks like a bug, I pinged the team, we'll investigate.

– Oleg Šelajev
Dec 3 '18 at 15:40












1 Answer
1






active

oldest

votes


















0














As a workaround, I unpack graal related libs from fat jar, which is support by springboot. Then graal init successed.
In runtime env, path of unpacked libs look like this:



/tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-scriptengine-1.0.0-rc9.jar
/tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-1.0.0-rc9.jar


In my project's build.gradle, below part need be added



bootJar {
requiresUnpack '**/js-*.jar'
requiresUnpack '**/regex-*.jar'
requiresUnpack '**/truffle-api-*.jar'
requiresUnpack '**/graal-sdk-*.jar'}


More details ref:
https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/gradle-plugin/reference/html/#packaging-executable-configuring-unpacking






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53512250%2ffilesystemnotfoundexception-when-init-graal-in-springboot%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As a workaround, I unpack graal related libs from fat jar, which is support by springboot. Then graal init successed.
    In runtime env, path of unpacked libs look like this:



    /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-scriptengine-1.0.0-rc9.jar
    /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-1.0.0-rc9.jar


    In my project's build.gradle, below part need be added



    bootJar {
    requiresUnpack '**/js-*.jar'
    requiresUnpack '**/regex-*.jar'
    requiresUnpack '**/truffle-api-*.jar'
    requiresUnpack '**/graal-sdk-*.jar'}


    More details ref:
    https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/gradle-plugin/reference/html/#packaging-executable-configuring-unpacking






    share|improve this answer




























      0














      As a workaround, I unpack graal related libs from fat jar, which is support by springboot. Then graal init successed.
      In runtime env, path of unpacked libs look like this:



      /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-scriptengine-1.0.0-rc9.jar
      /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-1.0.0-rc9.jar


      In my project's build.gradle, below part need be added



      bootJar {
      requiresUnpack '**/js-*.jar'
      requiresUnpack '**/regex-*.jar'
      requiresUnpack '**/truffle-api-*.jar'
      requiresUnpack '**/graal-sdk-*.jar'}


      More details ref:
      https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/gradle-plugin/reference/html/#packaging-executable-configuring-unpacking






      share|improve this answer


























        0












        0








        0







        As a workaround, I unpack graal related libs from fat jar, which is support by springboot. Then graal init successed.
        In runtime env, path of unpacked libs look like this:



        /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-scriptengine-1.0.0-rc9.jar
        /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-1.0.0-rc9.jar


        In my project's build.gradle, below part need be added



        bootJar {
        requiresUnpack '**/js-*.jar'
        requiresUnpack '**/regex-*.jar'
        requiresUnpack '**/truffle-api-*.jar'
        requiresUnpack '**/graal-sdk-*.jar'}


        More details ref:
        https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/gradle-plugin/reference/html/#packaging-executable-configuring-unpacking






        share|improve this answer













        As a workaround, I unpack graal related libs from fat jar, which is support by springboot. Then graal init successed.
        In runtime env, path of unpacked libs look like this:



        /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-scriptengine-1.0.0-rc9.jar
        /tmp/policy-engine.jar-spring-boot-libs-19affd93-0dd2-451a-b469-75fe0c4f458d/js-1.0.0-rc9.jar


        In my project's build.gradle, below part need be added



        bootJar {
        requiresUnpack '**/js-*.jar'
        requiresUnpack '**/regex-*.jar'
        requiresUnpack '**/truffle-api-*.jar'
        requiresUnpack '**/graal-sdk-*.jar'}


        More details ref:
        https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/gradle-plugin/reference/html/#packaging-executable-configuring-unpacking







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 13 '18 at 8:30









        texutexu

        161




        161
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53512250%2ffilesystemnotfoundexception-when-init-graal-in-springboot%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks