If two hibernate bundles cause two EntityManager services to be generated then I think this is a bug. Can you open a jira issue about it? I will take care of the fix then.
Christian 2016-01-07 8:50 GMT+01:00 cniehues <[email protected]>: > Now I figured out my problem: the blueprint-maven-plugin wasn't working at > all. The problem is that the execution part was missing: > > <executions> > <execution> > <goals> > <goal>blueprint-generate</goal> > </goals> > <phase>process-classes</phase> > </execution> > </executions> > > I think this results from your tasklist example where the execution part is > missing in the persistence bundle but it is present in the parent. This is > a > little bit misleading. > > So now I get my EntityManager injected and I can confirm that the mixing of > annotations and xml just works! > > About the two EntityManager: there is only one Aries JPA container > installed. Maybe the two hibernate entitymanager bundles are the cause of > this (I try to use hibernate 5 because of better osgi support while the > tasklist example uses a hibernate 4 version). > > ID | State | Lvl | Version | Name > > --------------------------------------------------------------------------------------------- > 52 | Active | 80 | 5.0.6.Final-karaf | hibernate-osgi > 53 | Active | 80 | 0 | > wrap_mvn_com.oracle_ojdbc6_11.2.0 > 54 | Active | 80 | 3.18.1.GA | Javassist > 56 | Active | 80 | 1.2.0 | CDI APIs > 57 | Active | 80 | 1.2 | javax.interceptor API > 58 | Active | 80 | 2.1.0.v201304241213 | Java Persistence API 2.1 > 59 | Active | 80 | 1.2 | javax.transaction API > 60 | Active | 80 | 2.2.0 | Apache Aries JPA Container API > 61 | Active | 80 | 2.2.0 | Apache Aries JPA blueprint > 62 | Active | 80 | 2.2.0 | Apache Aries JPA container > 63 | Active | 80 | 2.2.0 | Apache Aries JPA support > 64 | Active | 80 | 1.0.0 | Apache Felix Coordinator Service > 65 | Active | 80 | 1.1.1 | geronimo-jta_1.1_spec > 66 | Active | 80 | 2.7.7.5 | Apache ServiceMix :: Bundles :: > antlr > 67 | Active | 80 | 1.6.1.5 | Apache ServiceMix :: Bundles :: > dom4j > 68 | Active | 80 | 1.0.0.2 | Apache ServiceMix :: Bundles :: > javax.inject > 69 | Active | 80 | 5.0.1.Final | hibernate-commons-annotations > 70 | Active | 80 | 5.0.6.Final | hibernate-core > 71 | Active | 80 | 5.0.6.Final | hibernate-entitymanager > 72 | Active | 80 | 1.0.0.Final | hibernate-jpa-2.1-api > 73 | Active | 80 | 5.0.6.Final | hibernate-osgi > 74 | Active | 80 | 2.0.0.Final | Java Annotation Indexer > 75 | Active | 80 | 3.3.0.Final | JBoss Logging 3 > 78 | Active | 80 | 0.7.0 | OPS4J Pax JDBC Generic Driver > Extender > 79 | Active | 80 | 0.7.0 | OPS4J Pax JDBC Config > 80 | Active | 80 | 1.8.1 | OPS4J Pax Swissbox :: OSGi Core > 81 | Active | 80 | 1.8.1 | OPS4J Pax Swissbox :: Extender > 82 | Active | 80 | 1.8.1 | OPS4J Pax Swissbox :: Lifecycle > 83 | Active | 80 | 1.0.0.201505202023 | org.osgi:org.osgi.service.jdbc > 85 | Active | 80 | 2.0.0 | Apache Aries Transaction > Blueprint > 86 | Active | 80 | 1.3.0 | Apache Aries Transaction Manager > 87 | Active | 80 | 2.1.0 | Apache Commons DBCP > 88 | Active | 80 | 2.4.1 | Apache Commons Pool > 89 | Active | 80 | 4.0.3 | Apache Karaf :: JDBC :: Core > 90 | Active | 80 | 3.0.0.1 | Apache ServiceMix :: Bundles :: > cglib > 91 | Active | 80 | 0.7.0 | OPS4J Pax JDBC Oracle Driver > Adapter > 92 | Active | 80 | 0.7.0 | OPS4J Pax JDBC Pooling Support > Base > 93 | Active | 80 | 0.7.0 | OPS4J Pax JDBC Pooling Support > using Commons-DBCP2 > 97 | Active | 80 | 2.16.1 | camel-blueprint > 98 | Active | 80 | 2.16.1 | camel-catalog > 99 | Active | 80 | 2.16.1 | camel-commands-core > 100 | Active | 80 | 2.16.1 | camel-core > 101 | Active | 80 | 2.16.1 | camel-karaf-commands > 102 | Active | 80 | 2.2.6.1 | Apache ServiceMix :: Bundles :: > jaxb-impl > 106 | Active | 80 | 1.1.1 | Apache Aries Transaction > Blueprint > 107 | Active | 80 | 1.1.0 | ClassMate > 135 | Active | 80 | 1.8.2.2 | Apache ServiceMix :: Bundles :: > ant > 172 | Active | 80 | 1.3.172 | H2 Database Engine > 173 | Active | 80 | 4.0.4.Final | hibernate-commons-annotations > 174 | Active | 80 | 4.3.6.Final | hibernate-core > 175 | Active | 80 | 4.3.6.Final | hibernate-entitymanager > 176 | Active | 80 | 4.3.6.Final | hibernate-osgi > 177 | Active | 80 | 1.0.2.Final | JACC 1.4 API > 187 | Active | 80 | 1.0.0.SNAPSHOT | angular-ui > 188 | Active | 80 | 1.0.0.SNAPSHOT | model > 189 | Active | 80 | 1.0.0.SNAPSHOT | persistence > 190 | Active | 80 | 1.0.0.SNAPSHOT | service > 191 | Active | 80 | 1.0.0.SNAPSHOT | pra-osgi-sid Bundle > 192 | Active | 80 | 1.0.0.SNAPSHOT | pra-osgi-dao-api Blueprint > Bundle > 193 | Active | 80 | 1.0.0.SNAPSHOT | pra-osgi-dao-impl Blueprint > Bundle > 194 | Active | 80 | 1.0.0.SNAPSHOT | pra Camel Blueprint Bundle > 195 | Active | 80 | 1.0.1 | Apache Aries Blueprint > Annotation > API > 206 | Active | 80 | 1.5.0 | OPS4J Base - All > 207 | Active | 80 | 1.0.0.RC1 | OPS4J Pax CDI Bean Bundle API > 208 | Active | 80 | 1.0.0.RC1 | OPS4J Pax CDI Extender for Bean > Bundles > 209 | Active | 80 | 1.0.0.RC1 | OPS4J Pax CDI Portable Extension > for OSGi > 210 | Active | 80 | 1.0.0.RC1 | OPS4J Pax CDI Service Provider > Interface > 211 | Active | 80 | 1.8.1 | OPS4J Pax Swissbox :: Tracker > > Thanks for the help, > Christian > > > > -- > View this message in context: > http://karaf.922171.n3.nabble.com/Injection-Problem-with-JPA-and-Camel-in-Karaf-4-0-3-tp4044627p4044675.html > Sent from the Karaf - User mailing list archive at Nabble.com. > -- -- Christian Schneider http://www.liquid-reality.de <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de> Open Source Architect http://www.talend.com <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
