What the log says is that your bundle requires an EntityManagerFactory for the persistence unit test but can not find one.

Unfortunately there are several possible reasons and aries jpa does not show good errors.

1. Possibly your Manifest does not contain the Meta-Persistence entry.

Make sure you have this in the maven bundle plugin config:
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>

2. There are no providers available hints that aries jpa does not find a PersitenceProvider service. I had this with hibernate 3.3.x. It published a service but the with the jpa 2.1 version of the package. So aries jpa did not see it. Check the headers of openjpa and aries jpa container if this is the case. JB told me he is preparing a patch for aries jpa to have a wider import range for the jpa spec packages. Until then make sure you use an older version
of the persistence provider that works with jpa 2.0.

3. Possibly the persistence context is found but there is an error initializing it. Aries jpa swallows these errors. There is a patch in this issue that solves this:
https://issues.apache.org/jira/browse/ARIES-1160

From the log It think variant 2 is the most probable. I just tried to install jpa and openjpa in karaf 3.0.1 but it seems to use jpa 2.0 so that speaks against this case.

Christian


On 15.04.2014 22:26, Nick Stuart wrote:
Hi all, I am having issues getting a very simple JPA example running, and I am out of ideas on where to head next.

I pretty much have the same problem described here:
http://karaf.922171.n3.nabble.com/JPA-with-Karaf-td4031000.html
The posts there suggest it should be fixed with 3.0.1 (which I am using), but it does not appear to be. The very odd thing is that I did get it working once, but now it's broken again and I don't know why.

I've installed the following features, transaction,jpa,openjpa,jndi, and jdbc. I can connect to the database through the JDBC commands and all of that is working just fine. My bundle will not start though.

Here are the log messages I get when installing my bundle:

2014-04-15 16:11:28,366 | WARN | Local user karaf | container | 114 - org.apache.aries.jpa.container - 1.0.0 | There are no providers available. 2014-04-15 16:11:28,367 | INFO | Local user karaf | Activator | 244 - com.pww.test.demo - 1.0.0.SNAPSHOT | Hello updated!! 2014-04-15 16:11:28,372 | INFO | Local user karaf | BlueprintContainerImpl | 19 - org.apache.aries.blueprint.core - 1.4.0 | Bundle com.pww.test.demo is waiting for dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name <http://osgi.unit.name/>=test))(objectClass=javax.persistence.EntityManagerFactory))] 2014-04-15 16:11:28,373 | WARN | Local user karaf | container | 114 - org.apache.aries.jpa.container - 1.0.0 | There are no providers available.

and the out of running `ls | grep persistence`:

karaf@root(jdbc)> ls | grep persistence
[javax.persistence.spi.PersistenceProvider]
javax.persistence.provider = org.apache.openjpa.persistence.PersistenceProviderImpl javax.persistence.spi.PersistenceProvider = org.apache.openjpa.persistence.PersistenceProviderImpl

Not really sure what to look at next. Any thoughts or ideas would be great.

Thanks!


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Reply via email to