0

I'm currently working on a project with a plugin system using Java's ServiceLoader. The plugin manager creates an URL classloader with the URLs of the jar-files, which is used to load the plugins. When creating the EntityManagerFactory, I set the eclipselink.classloader property to the created URL class loader, which should enfore the EntityManagerFactory to use my classloader for entity autodetection. However, Eclipselink fails to detect the entities in the plugins.

Eclipselink's logging (log level set to finest) does not mention the entities in the plugins at all, only the entities in the base project. I even tried pre-loading the entity and metamodel classes, but still no change.

user2610529
  • 491
  • 3
  • 10
  • If I understand, You try do dynamically add entity classes to live EMF? Seems be impossible. Eclipselink can accept before opening, google XMLMetadataSource sample. – Jacek Cz Oct 12 '15 at 08:05
  • No, when I create the EntityManagerFactory, I add as parameter `eclipselink.classloader=[URLClassLoader]`, so it should use the classloader I specified when searching for entities. I've also found the XMLMetadataSource solution, but if I understood it correctly, I have to generate a XML document on the fly, which sounds kinda overkill to me – user2610529 Oct 12 '15 at 18:30
  • I'm nor ready to this themat. Fast google dont give mi promise "class loader used form entity class scanning". Where such conception is written? – Jacek Cz Oct 12 '15 at 20:29

0 Answers0