{"action":"closed","issue":{"url":"https://api.github.com/repos/Terracotta-OSS/terracotta-platform/issues/62","repository_url":"https://api.github.com/repos/Terracotta-OSS/terracotta-platform","labels_url":"https://api.github.com/repos/Terracotta-OSS/terracotta-platform/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/Terracotta-OSS/terracotta-platform/issues/62/comments","events_url":"https://api.github.com/repos/Terracotta-OSS/terracotta-platform/issues/62/events","html_url":"https://github.com/Terracotta-OSS/terracotta-platform/issues/62","id":151947647,"number":62,"title":"ServiceRegistry.getService(OffHeapResourceIdentifier) returns null","user":{"login":"cljohnso","id":8737388,"avatar_url":"https://avatars.githubusercontent.com/u/8737388?v=3","gravatar_id":"","url":"https://api.github.com/users/cljohnso","html_url":"https://github.com/cljohnso","followers_url":"https://api.github.com/users/cljohnso/followers","following_url":"https://api.github.com/users/cljohnso/following{/other_user}","gists_url":"https://api.github.com/users/cljohnso/gists{/gist_id}","starred_url":"https://api.github.com/users/cljohnso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cljohnso/subscriptions","organizations_url":"https://api.github.com/users/cljohnso/orgs","repos_url":"https://api.github.com/users/cljohnso/repos","events_url":"https://api.github.com/users/cljohnso/events{/privacy}","received_events_url":"https://api.github.com/users/cljohnso/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Terracotta-OSS/terracotta-platform/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"cljohnso","id":8737388,"avatar_url":"https://avatars.githubusercontent.com/u/8737388?v=3","gravatar_id":"","url":"https://api.github.com/users/cljohnso","html_url":"https://github.com/cljohnso","followers_url":"https://api.github.com/users/cljohnso/followers","following_url":"https://api.github.com/users/cljohnso/following{/other_user}","gists_url":"https://api.github.com/users/cljohnso/gists{/gist_id}","starred_url":"https://api.github.com/users/cljohnso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cljohnso/subscriptions","organizations_url":"https://api.github.com/users/cljohnso/orgs","repos_url":"https://api.github.com/users/cljohnso/repos","events_url":"https://api.github.com/users/cljohnso/events{/privacy}","received_events_url":"https://api.github.com/users/cljohnso/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-04-29T19:11:28Z","updated_at":"2016-05-06T18:52:40Z","closed_at":"2016-05-06T18:52:40Z","body":"An active Entity (EhcacheActiveEntity in the failing case) attempting to use the ServiceRegistry to locate an OffHeapResource identified by an OffHeapResourceIdentifier fails to find the resource even though defined.  \r\n\r\nThe underlying cause of this failure is the difference in ClassLoaders used for services versus entities -- \r\nservice-defined objects are loaded using a ComponentURLClassLoader and objects instantiated by an entity are loaded using an AppClassLoader.  Configured in a <service> element of a tc-config.xml, OffHeapResource instances are created using the ComponentURLClassLoader (as are the OffHeapResourceIdentifier instances used to track them).  When an Entity uses ServiceRegistry.getService to attempt to look up an OffHeapResource, the OffHeapResourceIdentifier is \r\nconstructed using the AppClassLoader (along with the OffHeapResource reference that class contains).  The OffHeapResource class reference, used as a map key within ServiceRegistry, fails to match when the key and lookup argument are loaded by different ClassLoaders.\r\n\r\nTo force the use of a common ClassLoader, the OffHeapResource and OffHeapResourceIdentifier classes need to be marked with the @CommonComponent annotation (in org.terracotta:packaging-support)."}}