like below fixes the issue You need to get the path right. getClass().getResourceAsStream("...") loads a file relative to the path the current class is located in (because you use the class to query the resource). Thus, if your class is located in a package named com.example.mypackage and you give a string "config.yaml", that file is searched relative to the class' package folder.
I think the issue was by ths following , Due to the Same-Origin Policy, you cannot use AJAX to read a file from a different domain. The whole point of $.getJSON() is that it uses JSONP to bypass this restriction.
How to read a file that is located in the project folder java