Hello,
we have a Task that loads up a Spring application context and some Hibernate configuration. When the task is run as a standalone Java application (calling run() from a main method) everything works fine. However, when it is executed on a JPPFNode it has problems loading Hibernate’s persistence.xml, which appears to be loaded twice from different locations.
The persistence.xml is located in a META-INF folder and loaded from the classpath. When the Hibernate data source is initialized by Spring, we get an IllegalStateException with the message „Conflicting persistence unit definitions for name <our persistence configuration name>“. The message further states that the files in conflict are located in C:\Users\speedophot\AppData\Local\Temp\.jppf\<some-UUID> and C:\Users\speedophot\AppData\Local\Temp\.jppf\<some-UUID>_10
Indeed, both directories contain identical persistence.xml files. These are copies of the one we actually want to load. We made sure that the persistence.xml only appears once on the classpath.
I am probably missing something here. The folders with the persistence.xml files look like cache directories for the JPPF classloader, but I do not know the purpose of the enumerated versions of these directories. We always get the conflict between a copy of the persistence.xml in the folder without a enumeration suffix and another folder with the same UUID and some enumeration suffix (see example above). I suspect that the persistence.xml, which is actually the right one, is loaded twice by spring from different files. Hibernate considers the two copies as different and conflicting persistence-configurations.
Could this be related to JPPF’s classloading mechanism and, if yes, is there a way to prevent this problem? Yet, the only solution seems to be not to load the persistence.xml from the classpath which is tricky and does not feel like the right way to do it.
Thanks,
Speedophot
PS: We use JPPF 3.3.6 and Spring 3.0