{"action":"created","issue":{"url":"https://api.github.com/repos/netty/netty/issues/5545","repository_url":"https://api.github.com/repos/netty/netty","labels_url":"https://api.github.com/repos/netty/netty/issues/5545/labels{/name}","comments_url":"https://api.github.com/repos/netty/netty/issues/5545/comments","events_url":"https://api.github.com/repos/netty/netty/issues/5545/events","html_url":"https://github.com/netty/netty/pull/5545","id":165838438,"number":5545,"title":"Fix the tcnative lib loading problem in OSGi","user":{"login":"xsir","id":1182445,"avatar_url":"https://avatars.githubusercontent.com/u/1182445?v=3","gravatar_id":"","url":"https://api.github.com/users/xsir","html_url":"https://github.com/xsir","followers_url":"https://api.github.com/users/xsir/followers","following_url":"https://api.github.com/users/xsir/following{/other_user}","gists_url":"https://api.github.com/users/xsir/gists{/gist_id}","starred_url":"https://api.github.com/users/xsir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xsir/subscriptions","organizations_url":"https://api.github.com/users/xsir/orgs","repos_url":"https://api.github.com/users/xsir/repos","events_url":"https://api.github.com/users/xsir/events{/privacy}","received_events_url":"https://api.github.com/users/xsir/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-15T17:29:24Z","updated_at":"2016-07-19T12:53:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/5545","html_url":"https://github.com/netty/netty/pull/5545","diff_url":"https://github.com/netty/netty/pull/5545.diff","patch_url":"https://github.com/netty/netty/pull/5545.patch"},"body":"Motivation:\r\n\r\nAs the issue #5539 say, the OpenSsl.class will throw `java.lang.UnsatisfiedLinkError: org.apache.tomcat.jni.Library.version(I)I` when it is invoked. This path try to resolve the problem by modifying the native library loading logic of OpenSsl.class.\r\n\r\nModifications:\r\n\r\nThe OpenSsl.class loads the tcnative lib by `NativeLibraryLoader.loadFirstAvailable()`. The native library will be loaded in the bundle `netty-common`'s ClassLoader, which is diff with the native class's ClassLoader. That is the root cause of throws `UnsatisfiedLinkError` when the native method is invoked.\r\nSo, it should load the native library by the its bundle classloader firstly, then the embedded resources if failed.\r\n\r\nResult:\r\n\r\nFirst of all, the error threw by native method problem will be resolved.\r\nSecondly, the native library should work as normal in non-OSGi env. But, this is hard. The loading logic of `Library.class` in `netty-tcnative` bundle is simple: try to load the library in PATH env. If not found, it falls back to the originally logic `NativeLibraryLoader.loadFirstAvailable()`.\r\n\r\nBTW: this path depend on netty-tcnative-1.1.33.Fork19 version (with Bundle-NativeCode manifest entry added).\r\n\r\nSigned-off-by: XU JINCHUAN <xsir@msn.com>"},"comment":{"url":"https://api.github.com/repos/netty/netty/issues/comments/233622658","html_url":"https://github.com/netty/netty/pull/5545#issuecomment-233622658","issue_url":"https://api.github.com/repos/netty/netty/issues/5545","id":233622658,"user":{"login":"johnou","id":323497,"avatar_url":"https://avatars.githubusercontent.com/u/323497?v=3","gravatar_id":"","url":"https://api.github.com/users/johnou","html_url":"https://github.com/johnou","followers_url":"https://api.github.com/users/johnou/followers","following_url":"https://api.github.com/users/johnou/following{/other_user}","gists_url":"https://api.github.com/users/johnou/gists{/gist_id}","starred_url":"https://api.github.com/users/johnou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnou/subscriptions","organizations_url":"https://api.github.com/users/johnou/orgs","repos_url":"https://api.github.com/users/johnou/repos","events_url":"https://api.github.com/users/johnou/events{/privacy}","received_events_url":"https://api.github.com/users/johnou/received_events","type":"User","site_admin":false},"created_at":"2016-07-19T12:53:08Z","updated_at":"2016-07-19T12:53:08Z","body":"You might be able to convince @normanmaurer changing method signature in NativeLibraryLoader is ok because it is internal :) "}}
{"actor":{"display_login":"johnou"}}