{"action":"created","issue":{"url":"https://api.github.com/repos/jankotek/mapdb/issues/555","labels_url":"https://api.github.com/repos/jankotek/mapdb/issues/555/labels{/name}","comments_url":"https://api.github.com/repos/jankotek/mapdb/issues/555/comments","events_url":"https://api.github.com/repos/jankotek/mapdb/issues/555/events","html_url":"https://github.com/jankotek/mapdb/issues/555","id":99677505,"number":555,"title":"Allow specification of the classloader for [de]serialisation","user":{"login":"gravelld","id":873704,"avatar_url":"https://avatars.githubusercontent.com/u/873704?v=3","gravatar_id":"","url":"https://api.github.com/users/gravelld","html_url":"https://github.com/gravelld","followers_url":"https://api.github.com/users/gravelld/followers","following_url":"https://api.github.com/users/gravelld/following{/other_user}","gists_url":"https://api.github.com/users/gravelld/gists{/gist_id}","starred_url":"https://api.github.com/users/gravelld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravelld/subscriptions","organizations_url":"https://api.github.com/users/gravelld/orgs","repos_url":"https://api.github.com/users/gravelld/repos","events_url":"https://api.github.com/users/gravelld/events{/privacy}","received_events_url":"https://api.github.com/users/gravelld/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-07T15:57:22Z","updated_at":"2015-08-07T18:10:05Z","closed_at":null,"body":"See also #377  .\r\n\r\nWhen MapDB [de]serialises objects, it needs to load the classes each object implements.\r\n\r\nIn a Java app running in a vanilla application container, using Class.forName is sufficient for this, because there is no class scope and all classes are known to all classes.\r\n\r\nIn an OSGi container, the scope is far more constrained. MapDB is deployed as its own \"bundle\" and using Class.forName will only work to load classes in the packages that the MapDB bundle has been pre-configured to know about.\r\n\r\nThis is a problem common with ORMs. The problem is more eloquently and authoritatively described in http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html . Three solutions are suggested.\r\n\r\nFor my own use, I have hacked MapDB to have a `setClassloader` method on `DBMaker` which is passed through to the serialisation layer. This is then used for loading classes, and it works well. However, whoever does this work for MapDB should consider which of the three options presented above makes most sense from MapDB's perspective."},"comment":{"url":"https://api.github.com/repos/jankotek/mapdb/issues/comments/128784305","html_url":"https://github.com/jankotek/mapdb/issues/555#issuecomment-128784305","issue_url":"https://api.github.com/repos/jankotek/mapdb/issues/555","id":128784305,"user":{"login":"jankotek","id":359021,"avatar_url":"https://avatars.githubusercontent.com/u/359021?v=3","gravatar_id":"","url":"https://api.github.com/users/jankotek","html_url":"https://github.com/jankotek","followers_url":"https://api.github.com/users/jankotek/followers","following_url":"https://api.github.com/users/jankotek/following{/other_user}","gists_url":"https://api.github.com/users/jankotek/gists{/gist_id}","starred_url":"https://api.github.com/users/jankotek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jankotek/subscriptions","organizations_url":"https://api.github.com/users/jankotek/orgs","repos_url":"https://api.github.com/users/jankotek/repos","events_url":"https://api.github.com/users/jankotek/events{/privacy}","received_events_url":"https://api.github.com/users/jankotek/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T18:10:05Z","updated_at":"2015-08-07T18:10:05Z","body":"I will have a look, thanks for good documentation.\n\nOn August 7, 2015 5:57:25 PM CEST, gravelld <notifications@github.com> wrote:\n>See also #377  .\n>\n>When MapDB [de]serialises objects, it needs to load the classes each\n>object implements.\n>\n>In a Java app running in a vanilla application container, using\n>Class.forName is sufficient for this, because there is no class scope\n>and all classes are known to all classes.\n>\n>In an OSGi container, the scope is far more constrained. MapDB is\n>deployed as its own \"bundle\" and using Class.forName will only work to\n>load classes in the packages that the MapDB bundle has been\n>pre-configured to know about.\n>\n>This is a problem common with ORMs. The problem is more eloquently and\n>authoritatively described in\n>http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html .\n>Three solutions are suggested.\n>\n>For my own use, I have hacked MapDB to have a `setClassloader` method\n>on `DBMaker` which is passed through to the serialisation layer. This\n>is then used for loading classes, and it works well. However, whoever\n>does this work for MapDB should consider which of the three options\n>presented above makes most sense from MapDB's perspective.\n>\n>---\n>Reply to this email directly or view it on GitHub:\n>https://github.com/jankotek/mapdb/issues/555\n"}}