{"action":"created","issue":{"url":"https://api.github.com/repos/jnr/jnr-ffi/issues/51","repository_url":"https://api.github.com/repos/jnr/jnr-ffi","labels_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/51/comments","events_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/51/events","html_url":"https://github.com/jnr/jnr-ffi/issues/51","id":109635997,"number":51,"title":"Support context class loader in NativeRuntime's closureManager","user":{"login":"btiernay","id":2717578,"avatar_url":"https://avatars.githubusercontent.com/u/2717578?v=3","gravatar_id":"","url":"https://api.github.com/users/btiernay","html_url":"https://github.com/btiernay","followers_url":"https://api.github.com/users/btiernay/followers","following_url":"https://api.github.com/users/btiernay/following{/other_user}","gists_url":"https://api.github.com/users/btiernay/gists{/gist_id}","starred_url":"https://api.github.com/users/btiernay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btiernay/subscriptions","organizations_url":"https://api.github.com/users/btiernay/orgs","repos_url":"https://api.github.com/users/btiernay/repos","events_url":"https://api.github.com/users/btiernay/events{/privacy}","received_events_url":"https://api.github.com/users/btiernay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-10-03T17:55:33Z","updated_at":"2016-12-31T06:12:42Z","closed_at":null,"body":"In some circumstances it would be useful to replace:\n\n``` java\n  private final NativeClosureManager closureManager = new NativeClosureManager(this,\n            new SignatureTypeMapperAdapter(new DefaultTypeMapper()),\n            new AsmClassLoader(ClassLoader.getSystemClassLoader()));\n```\n\nwith \n\n``` java\n  private final NativeClosureManager closureManager = new NativeClosureManager(this,\n            new SignatureTypeMapperAdapter(new DefaultTypeMapper()),\n            new AsmClassLoader(Thread.currentThread().getContextClassLoader()));\n\n```\n\nA good example is with Spring Boot's nested jars which have the following [restriction](http://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html#executable-jar-system-classloader):\n\n> Launched applications should use Thread.getContextClassLoader() when loading classes (most libraries and frameworks will do this by default). Trying to load nested jar classes via ClassLoader.getSystemClassLoader() will fail.\n\nPlease see http://www.javaworld.com/article/2077344/core-java/find-a-way-out-of-the-classloader-maze.html for a good discussion of this.\n"},"comment":{"url":"https://api.github.com/repos/jnr/jnr-ffi/issues/comments/269851698","html_url":"https://github.com/jnr/jnr-ffi/issues/51#issuecomment-269851698","issue_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/51","id":269851698,"user":{"login":"neupsh","id":5186871,"avatar_url":"https://avatars.githubusercontent.com/u/5186871?v=3","gravatar_id":"","url":"https://api.github.com/users/neupsh","html_url":"https://github.com/neupsh","followers_url":"https://api.github.com/users/neupsh/followers","following_url":"https://api.github.com/users/neupsh/following{/other_user}","gists_url":"https://api.github.com/users/neupsh/gists{/gist_id}","starred_url":"https://api.github.com/users/neupsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neupsh/subscriptions","organizations_url":"https://api.github.com/users/neupsh/orgs","repos_url":"https://api.github.com/users/neupsh/repos","events_url":"https://api.github.com/users/neupsh/events{/privacy}","received_events_url":"https://api.github.com/users/neupsh/received_events","type":"User","site_admin":false},"created_at":"2016-12-31T06:12:42Z","updated_at":"2016-12-31T06:12:42Z","body":"Is there any update on this issue? I was trying to use jnr related java library in clojure and when i run the project with boot-clj build tool, it fails to load the class with:\r\n```\r\njava.lang.ClassNotFoundException: jnr.ffi.provider.jffi.NativeClosureProxy\r\n             java.lang.NoClassDefFoundError: jnr/ffi/provider/jffi/NativeClosureProxy\r\n                 java.lang.RuntimeException: java.lang.NoClassDefFoundError: jnr/ffi/provider/jffi/NativeClosureProxy\r\n```\r\nThis is because, boot-clj runs 'boot-tasks' in 'pods', which are clojure runtimes in single JVM. They are separated by different classloaders and thus the dependencies are tied to these different classloaders. The System ClassLoader does not have any libraries in the classpath and as a result, it fails to load the class."}}
{"actor":{"display_login":"neupsh"}}