
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
problem accessing to JPA
Hi,
I am trying to access JPA from Talend ESB job.
I have a jar containing my entity classes and my dao/service beans. The jar works with JUnit/JavaSE and with Spring/Apache CXF/Tomcat/JavaEE as web services.
I started a User Routine and added my jar to it along with some Spring and Hibernate jars.
My jar has META-INF/persistence.xml file with the persistence unit named "oso" and I am able to reach to it within my routine through the following:
new Object().getClass().getClassLoader().getSystemResourceAsStream("META-INF/persistence.xml");
I am also able to reach to all of my classes.
But the following cannot get the entity manager factory:
EntityManagerFactory emf=Persistence.createEntityManagerFactory("oso");
I get:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named oso
What could that be?
I suspect, that could be related to an alternative class loader if Talend is using one. Because I also have had a number of other issues with Spring context initialization and those issues do not happen either in standalone or in web application environments. After all this is a POC project and those beans and the Spring configuration are all very lean and basic. I can see when I add a jar to a Talend routine it is copied into Talend lib folder and afterwards, I cannot tell how a class is resolved in run time if there are jars from different versions of (for example) Hibernate/JPA in the lib folder.
