{"action":"created","issue":{"url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/894","labels_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/894/labels{/name}","comments_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/894/comments","events_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/894/events","html_url":"https://github.com/JohnLangford/vowpal_wabbit/issues/894","id":123538744,"number":894,"title":"Docker Java Native Library `java.lang.UnsatisfiedLinkError: no vw_jni in java.library.path`","user":{"login":"adgaudio","id":860369,"avatar_url":"https://avatars.githubusercontent.com/u/860369?v=3","gravatar_id":"","url":"https://api.github.com/users/adgaudio","html_url":"https://github.com/adgaudio","followers_url":"https://api.github.com/users/adgaudio/followers","following_url":"https://api.github.com/users/adgaudio/following{/other_user}","gists_url":"https://api.github.com/users/adgaudio/gists{/gist_id}","starred_url":"https://api.github.com/users/adgaudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adgaudio/subscriptions","organizations_url":"https://api.github.com/users/adgaudio/orgs","repos_url":"https://api.github.com/users/adgaudio/repos","events_url":"https://api.github.com/users/adgaudio/events{/privacy}","received_events_url":"https://api.github.com/users/adgaudio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-22T19:07:01Z","updated_at":"2015-12-23T21:58:40Z","closed_at":null,"body":"Hi,\r\n\r\nWe have a java project that uses VW, and we love it!  However, when the java code runs in an Ubuntu 14.04 docker container, it can't load the native bindings.   I figured out why this happens and will propose a solution at the bottom of this issue description.\r\n\r\n**The Error:**  The following traceback occurs when we run our java program inside a docker container that inherits from Ubuntu:14.04.\r\n```\r\n[info] java.lang.UnsatisfiedLinkError: no vw_jni in java.library.path\r\n[info]  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)\r\n[info]  at java.lang.Runtime.loadLibrary0(Runtime.java:870)\r\n[info]  at java.lang.System.loadLibrary(System.java:1122)\r\n[info]  at vw.jni.NativeUtils.loadOSDependentLibrary(NativeUtils.java:116)\r\n[info]  at vw.learner.VWLearners.loadNativeLibrary(VWLearners.java:85)\r\n[info]  at vw.learner.VWLearners.initializeVWJni(VWLearners.java:73)\r\n[info]  at vw.learner.VWLearners.create(VWLearners.java:44)\r\n```\r\n\r\n**Why this happens:**\r\nLooking at VW source code for `java/src/main/java/vw/jni/NativeUtils.java`, a function named `getDistroName` directly queries `/proc/version` ([see source](https://github.com/JohnLangford/vowpal_wabbit/blob/9e5831a72d5b0a124c845dcaec75879f498b355f/java/src/main/java/vw/jni/NativeUtils.java#L29)).  In docker, this returns the host's kernel version, which may not be Ubuntu.  (If you use docker-machine, /proc/version returns information about the docker-machine VM that the container runs in).  What we actually want it to do, as far as I understand, is query the container OS version, which is Ubuntu 14.04.\r\n\r\n**Possible Solution:**\r\nFor better compatibility with VW in docker containers, I suggest we don't query /proc/version.  What if, instead, we replace the linux-specific contents of `getDistroName` with `lsb_release -i`?  Since we already use `lsb_release -r` for `getLinuxVersion`, this seems to make quite a bit of sense to me, and I believe it will work in a docker container.\r\n\r\nI'd love to get your feedback and would be happy to submit a PR if necessary."},"comment":{"url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/comments/166998797","html_url":"https://github.com/JohnLangford/vowpal_wabbit/issues/894#issuecomment-166998797","issue_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/894","id":166998797,"user":{"login":"jmorra","id":117275,"avatar_url":"https://avatars.githubusercontent.com/u/117275?v=3","gravatar_id":"","url":"https://api.github.com/users/jmorra","html_url":"https://github.com/jmorra","followers_url":"https://api.github.com/users/jmorra/followers","following_url":"https://api.github.com/users/jmorra/following{/other_user}","gists_url":"https://api.github.com/users/jmorra/gists{/gist_id}","starred_url":"https://api.github.com/users/jmorra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmorra/subscriptions","organizations_url":"https://api.github.com/users/jmorra/orgs","repos_url":"https://api.github.com/users/jmorra/repos","events_url":"https://api.github.com/users/jmorra/events{/privacy}","received_events_url":"https://api.github.com/users/jmorra/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T21:58:40Z","updated_at":"2015-12-23T21:58:40Z","body":"I'm fine with changing this as long as it continues to work on Mac and builds with `build.sh` I have no problem with any change.  @adgaudio is this something you can work on?"}}