tags:

views:

256

answers:

2

We're using OSGI and want to write a JUnit Systemtest. We have one component, that interacts with the database using the Java Persistence API (JPA). When we're launching the test, we get an error message, that the database component couldn't be activated.

We think, that this error occurs, because jpa doesn't find the persistence.xml. But we tried copying the file on quite every possible location we could think of. Everytime the same error occured. Does anybody know a solution?

osgi> 10:03:49.461 [Component Resolve Thread] DEBUG f.d.s.system.test.SystemTest - started ERROR 22 [SCR] Cannot activate instance ...

A: 

No Persistence provider for EntityManager named bus.database So there is no JPA implementation present in the CLASSPATH. Obviously depends if "bus.database" is specified to only run on a specific JPA implementation (provider).

DataNucleus
What CLASSPATH do you mean? And which files do we have to enter there?Thanks for your fast answer
Manuel Kaspar
There is only one CLASSPATH in a Java app. Ok, an OSGi env has special handling for class loading, but anyway. What jars ? the Jpa implementation that you choose to use ? DataNucleus, EclipseLink, Hibernate, OpenJPA to name but a few.
DataNucleus
A: 

Try to implement your system test with Pax Exam. You have to define all required bundles for your test (e.g. JPA implementation bundle, your component etc.).

Dmytro Pishchukhin