I tried using version 2.6.1 of the Aries JPA examples, again with Karaf 4.1.3. Built the project, then copied the org.ops4j.datasource-tasklist.cfg file into the etc directory of a fresh Karaf. Launched Karaf, and installed features:
feature:install jdbc feature:install jndi feature:install jpa feature:install transaction feature:install hibernate feature:install pax-jdbc feature:install pax-jdbc-config feature:install pax-jdbc-h2 feature:install pax-jdbc-pool-dbcp2 Then: install -s mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/2.6.1 install -s mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.blueprint/2.6.1 Model bundle is active: 107 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA example tasklist model But the Example Blueprint Bundle goes into GracePeriod until it times out: 108 │ Failure │ 80 │ 2.6.1 │ Apache Aries JPA example tasklist blueprint diag 108 Apache Aries JPA example tasklist blueprint (108) ------------------------------------------------- Status: Failure Blueprint 11/22/17 10:03 AM Exception: null java.util.concurrent.TimeoutException ... Missing dependencies: (&(osgi.unit.name=tasklist)(objectClass=javax.persistence.EntityManager)) Best regards, Alex soto > On Nov 22, 2017, at 4:20 AM, João Assunção <joao.assun...@exploitsys.com> > wrote: > > I use Hibernate as the persistence engine and the following features: > > * jdbc > * pax-jdbc-h2 > * pax-jdbc-postgresql > * jpa > * hibernate > > In other projects I used eclipselink and they both work great. > > I noticed the missing requirement osgi.contract=JavaJPA. I don't use that in > my JPA bundles, and after some investigation I noticed it was introduced > recently in the snapshot version of aries JPA. > > Try to use the examples from aries.jpa version 2.6.1 > > > João Assunção > > Email: joao.assun...@exploitsys.com <mailto:joao.assun...@exploitsys.com> > Mobile: +351 916968984 > Phone: +351 211933149 > Web: www.exploitsys.com <http://www.exploitsys.com/> > > > > On Tue, Nov 21, 2017 at 4:24 PM, Jean-Baptiste Onofré <j...@nanthrax.net > <mailto:j...@nanthrax.net>> wrote: > Let me take a look'm. I was swamped on meetings today. > > Regards > JB > On Nov 21, 2017, at 17:23, Alex Soto <alex.s...@envieta.com > <mailto:alex.s...@envieta.com>> wrote: > Thank you Francois, I tried EclipseLink, but it still doesn’t work. I am > doing all this interactively on a fresh Karaf installation. In my case since > I do not have an actual database server, so I am using H2. I installed the > following features: > > feature:install jdbc > feature:install jndi > feature:install jpa > feature:install transaction > feature:install eclipselink > feature:install pax-jdbc > feature:install pax-jdbc-config > feature:install pax-jdbc-h2 > feature:install pax-jdbc-pool-dbcp2 > > list > > START LEVEL 100 , List Threshold: 50 > ID │ State │ Lvl │ Version │ Name > ───────────── > 28 │ Active │ 80 │ 4.1.3 │ Apache Karaf :: OSGi > Services :: Event > 53 │ Active │ 80 │ 1.9.2.1 │ Apache ServiceMix :: > Bundles :: jasypt > 54 │ Active │ 80 │ 1.5.0 │ OPS4J Base - Service > Provider Access > 55 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Generic > Driver Extender > 56 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Config > 57 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Pooling > Support Base > 58 │ Active │ 80 │ 1.0.0.201505202023 │ > org.osgi:org.osgi.service.jdbc > 59 │ Active │ 80 │ 4.1.3 │ Apache Karaf :: JDBC :: Core > 67 │ Active │ 80 │ 3.0.0 │ Expression Language 3.0 API > 68 │ Active │ 80 │ 1.2.0 │ CDI APIs > 69 │ Active │ 80 │ 1.2 │ javax.interceptor API > 70 │ Active │ 80 │ 1.2 │ javax.transaction API > 71 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA Container > API > 72 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA blueprint > 73 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA container > 74 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA support > 77 │ Active │ 80 │ 1.6.0 │ Commons Pool > 78 │ Active │ 80 │ 1.0.2 │ Apache Felix Coordinator > Service > 79 │ Active │ 80 │ 1.1.1 │ geronimo-jms_1.1_spec > 81 │ Active │ 80 │ 1.2 │ geronimo-servlet_2.5_spec > 83 │ Active │ 80 │ 1.7.0.6 │ Apache ServiceMix :: > Bundles :: ant > 84 │ Active │ 80 │ 1.4.0.3 │ Apache ServiceMix :: > Bundles :: commons-dbcp > 85 │ Active │ 80 │ 1.0.0.2 │ Apache ServiceMix :: > Bundles :: javax.inject > 88 │ Active │ 80 │ 1.1.1 │ Apache Aries Transaction > Blueprint > 89 │ Active │ 80 │ 2.1.0 │ Apache Aries Transaction > Blueprint > 90 │ Active │ 80 │ 1.3.3 │ Apache Aries Transaction > Manager > 91 │ Active │ 80 │ 2.1.0.v201304241213 │ Java Persistence API 2.1 > 92 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA Container > adapter for EclipseLink > 93 │ Active │ 80 │ 3.2.0.v201302191141 │ EclipseLink ANTLR > 94 │ Active │ 80 │ 5.0.1.v201405080102 │ EclipseLink ASM > 95 │ Active │ 80 │ 2.6.4.v20160829-44060b6 │ EclipseLink Core > 96 │ Active │ 80 │ 2.6.4.v20160829-44060b6 │ EclipseLink JPA > 97 │ Active │ 80 │ 2.6.4.v20160829-44060b6 │ EclipseLink Hermes Parser > 98 │ Active │ 80 │ 1.3.172 │ H2 Database Engine > 99 │ Active │ 80 │ 2.1.1 │ Apache Commons DBCP > 100 │ Active │ 80 │ 2.4.2 │ Apache Commons Pool > 101 │ Active │ 80 │ 3.2.4.1 │ Apache ServiceMix :: > Bundles :: cglib > 102 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Pooling DBCP2 > 103 │ Installed │ 80 │ 2.7.0.SNAPSHOT │ Apache Aries JPA example > tasklist model > > > Copied file: org.ops4j.datasource-tasklist.cfg. to etc containing: > > osgi.jdbc.driver.name <http://osgi.jdbc.driver.name/>=H2 > databaseName=tasklist;create=true > dataSourceName=tasklist > pool=dbcp2 > xa=true > jdbc.pool.maxTotal=8 > > No data source is created, either command: service:list DataSource, or > jdbc:ds-list don't show any data source. > Trying to deploy Aries-example jar > > install -s > mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/2.7.0-SNAPSHOT > > Produces Error: > > Error executing command: Error installing bundles: > Unable to start bundle > mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/2.7.0-SNAPSHOT: > org.osgi.framework.BundleException: Unable to resolve > org.apache.aries.jpa.example.tasklist.model [103](R 103.0): missing > requirement [org.apache.aries.jpa.example.tasklist.model [103](R 103.0)] > osgi.contract; (&(osgi.contract=JavaJPA)(version=2.1.0)) Unresolved > requirements: [[org.apache.aries.jpa.example.tasklist.model [103](R 103.0)] > osgi.contract; (&(osgi.contract=JavaJPA)(version=2.1.0))] > > > I am at evaluation/proof-of-concept stage, just trying to figure out what > works out-of-the-box, so I don’t have a project created, I am just using the > Aries JPA example. It does not look good as a viable approach so far. > > Best regards, > Alex soto > > > >> On Nov 21, 2017, at 10:44 AM, Francois Papon < francois.pa...@openobject.fr >> <mailto:francois.pa...@openobject.fr>> wrote: >> >> Hi, >> >> I use EclipseLink for JPA implementation in a custo Karaf distribution and >> it work's well. >> >> In my persistence feature pom I have this dependencies : >> >> <dependency> >> <groupId>org.osgi</groupId> >> <artifactId>org.osgi.core</artifactId> >> <scope>provided</scope> >> </dependency> >> >> <dependency> >> <groupId>org.osgi</groupId> >> <artifactId>osgi.cmpn</artifactId> >> <scope>provided</scope> >> </dependency> >> <!-- JPA --> >> <dependency> >> <groupId>org.eclipse.persistence</groupId> >> <artifactId>javax.persistence</artifactId> >> <scope>provided</scope> >> </dependency> >> <dependency> >> <groupId>org.apache.aries.jpa</groupId> >> <artifactId>org.apache.aries.jpa.api</artifactId> >> <scope>provided</scope> >> </dependency> >> >> and in my assembly this feature on boot : >> <feature>jdbc</feature> >> <feature>jndi</feature> >> <feature>jpa</feature> >> >> <feature>transaction</feature> >> <feature>eclipselink</feature> >> >> <feature>pax-jdbc</feature> >> <feature>pax-jdbc-config</feature> >> <feature>pax-jdbc-pool-hikaricp</feature> >> <feature>pax-jdbc-pool-aries</feature> >> <feature>pax-jdbc-postgresql</feature> >> >> in the etc folder the database config file >> "org.ops4j.datasource-mydatasource.cfg" : >> >> osgi.jdbc.driver.class=org.postgresql.Driver >> dataSourceName=my-datasource >> databaseName=my-database >> serverName=172.17.0.2 >> portNumber=5432 >> user=dbuser >> password=dbpassword >> >> Hope this help. >> >> Le 21/11/2017 à 17:57, Alex Soto a écrit : >>> Does anybody know a good, simple step by step tutorial on how to quickly >>> start using JPA 2.1 with Karaf 4.1.3? >>> At this point I am not requiring any specific JPA implementation/version >>> (Hibernate vs. any other). >>> So far using Karaf’s default has not worked for me. I would expect Karaf’s >>> defaults should work out our the box. >>> >>> >>>> On Nov 20, 2017, at 2:54 PM, Jean-Baptiste Onofré < j...@nanthrax.net >>>> <mailto:j...@nanthrax.net>> wrote: >>>> >>>> Ok, I see hibernate now. Let me check if I see the jpa spec bundle. >>>> >>>> Regards >>>> JB >>>> On Nov 20, 2017, at 20:42, Alex Soto < alex.s...@envieta.com >>>> <mailto:alex.s...@envieta.com>> wrote: >>>> Thank you JB for the quick response. >>>> OK, so I installed the jpa feature: >>>> >>>> feature:install jpa >>>> >>>> karaf@root()> list >>>> START LEVEL 100 , List Threshold: 50 >>>> ID │ State │ Lvl │ Version │ Name >>>> ────┼───────────┼─────┼────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── >>>> 28 │ Active │ 80 │ 4.1.3 │ Apache Karaf :: OSGi Services >>>> :: Event >>>> 52 │ Active │ 80 │ 1.3.0 │ ClassMate >>>> 53 │ Active │ 80 │ 3.20.0.GA <http://3.20.0.ga/> │ Javassist >>>> 54 │ Active │ 80 │ 1.2 │ javax.interceptor API >>>> 55 │ Active │ 80 │ 1.6.6 │ Byte Buddy (without >>>> dependencies) >>>> 56 │ Active │ 80 │ 2.7.7.5 │ Apache ServiceMix :: Bundles >>>> :: antlr >>>> 57 │ Active │ 80 │ 1.6.1.5 │ Apache ServiceMix :: Bundles >>>> :: dom4j >>>> 58 │ Active │ 80 │ 5.0.1.Final │ hibernate-commons-annotations >>>> 59 │ Active │ 80 │ 5.2.8.Final │ hibernate-core >>>> 60 │ Active │ 80 │ 1.0.0.Final │ hibernate-jpa-2.1-api >>>> 61 │ Active │ 80 │ 5.2.8.Final │ hibernate-osgi >>>> 62 │ Active │ 80 │ 2.0.3.Final │ Java Annotation Indexer >>>> 63 │ Active │ 80 │ 3.3.0.Final │ JBoss Logging 3 >>>> 65 │ Active │ 80 │ 1.9.2.1 │ Apache ServiceMix :: Bundles >>>> :: jasypt >>>> 66 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Config >>>> 67 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Pooling >>>> Support Base >>>> 68 │ Active │ 80 │ 1.0.0.201505202023 │ org.osgi:org.osgi.service.jdbc >>>> 69 │ Active │ 80 │ 1.3.172 │ H2 Database Engine >>>> 117 │ Active │ 80 │ 1.2.0 │ CDI APIs >>>> 118 │ Active │ 80 │ 1.2 │ javax.transaction API >>>> 119 │ Active │ 80 │ 1.1.1 │ Apache Aries Transaction >>>> Blueprint >>>> 120 │ Active │ 80 │ 2.1.0 │ Apache Aries Transaction >>>> Blueprint >>>> 121 │ Active │ 80 │ 1.3.3 │ Apache Aries Transaction >>>> Manager >>>> 122 │ Active │ 80 │ 1.0.2 │ Apache Felix Coordinator >>>> Service >>>> 123 │ Active │ 80 │ 1.0.0.2 │ Apache ServiceMix :: Bundles >>>> :: javax.inject >>>> 124 │ Installed │ 80 │ 2.7.0.SNAPSHOT │ Apache Aries JPA example >>>> tasklist model >>>> 125 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA Container API >>>> 126 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA blueprint >>>> 127 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA container >>>> 128 │ Active │ 80 │ 2.6.1 │ Apache Aries JPA support >>>> 129 │ Active │ 80 │ 1.1.1 │ geronimo-jms_1.1_spec >>>> 130 │ Active │ 80 │ 1.7.0.6 │ Apache ServiceMix :: Bundles >>>> :: antThe same problem persists >>>> >>>> And >>>> >>>> karaf@root()> bundle:diag 124 >>>> Apache Aries JPA example tasklist model (124) >>>> --------------------------------------------- >>>> Status: Installed >>>> Unsatisfied Requirements: >>>> [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)] osgi.service; >>>> (osgi.jndi.service.name <http://osgi.jndi.service.name/>=tasklist) >>>> [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)] >>>> osgi.contract; (&(osgi.contract=JavaJPA)(version=2.1.0)) >>>> Declarative Services >>>> >>>> >>>> Or is it something else I need to install? >>>> >>>> Best regards, >>>> >>>> Alex soto >>>> alex.s...@envieta.com <mailto:alex.s...@envieta.com> >>>> >>>> >>>> >>>>> On Nov 20, 2017, at 2:31 PM, Jean-Baptiste Onofré < j...@nanthrax.net >>>>> <mailto:j...@nanthrax.net>> wrote: >>>>> >>>>> I don't see the jpa engine in your bundle list ? Openjpa, hibernate, >>>>> eclipselink ? >>>>> The jpa version depends of the engine. >>>>> >>>>> Regards >>>>> JB >>>>> On Nov 20, 2017, at 20:09, Alex Soto < alex.s...@envieta.com >>>>> <mailto:alex.s...@envieta.com>> wrote: >>>>> Hello, >>>>> >>>>> This is my first attempt to use JPA with Karaf, so I am trying to follow >>>>> example from https://github.com/apache/aries-jpa >>>>> <https://github.com/apache/aries-jpa> using Karaf 4.1.3, so far >>>>> unsuccessfully. >>>>> On a clean Karaf I have installed the following: >>>>> >>>>> feature:install hibernate-orm >>>>> feature:install pax-jdbc-config >>>>> feature:install pax-jdbc-h2 >>>>> feature:install http-whiteboard >>>>> feature:install scr >>>>> feature:install transaction >>>>> >>>>> Then I copied the data source config file >>>>> org.ops4j.datasource-tasklist.cfg to the Karaf’s etc directory. >>>>> >>>>> Now, when I install the first Example bundle: >>>>> >>>>> install -s >>>>> mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/2.7.0-SNAPSHOT >>>>> Error executing command: Error installing bundles: >>>>> Unable to start bundle >>>>> mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/2.7.0-SNAPSHOT: >>>>> org.osgi.framework.BundleException: Unable to resolve >>>>> org.apache.aries.jpa.example.tasklist.model [124](R 124.0): missing >>>>> requirement [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)] >>>>> osgi.contract; (&(osgi.contract=JavaJPA)(version=2.1.0)) Unresolved >>>>> requirements: [[org.apache.aries.jpa.example.tasklist.model [124](R >>>>> 124.0)] osgi.contract; (&(osgi.contract=JavaJPA)(version=2.1.0))] >>>>> >>>>> list >>>>> START LEVEL 100 , List Threshold: 50 >>>>> ID │ State │ Lvl │ Version │ Name >>>>> ────┼────────┼─────┼────────────────────┼─────────────────────────────────────────── >>>>> 28 │ Active │ 80 │ 4.1.3 │ Apache Karaf :: OSGi Services >>>>> :: Event >>>>> 52 │ Active │ 80 │ 1.3.0 │ ClassMate >>>>> 53 │ Active │ 80 │ 3.20.0.GA <http://3.20.0.ga/> │ Javassist >>>>> 54 │ Active │ 80 │ 1.2 │ javax.interceptor API >>>>> 55 │ Active │ 80 │ 1.6.6 │ Byte Buddy (without >>>>> dependencies) >>>>> 56 │ Active │ 80 │ 2.7.7.5 │ Apache ServiceMix :: Bundles :: >>>>> antlr >>>>> 57 │ Active │ 80 │ 1.6.1.5 │ Apache ServiceMix :: Bundles :: >>>>> dom4j >>>>> 58 │ Active │ 80 │ 5.0.1.Final │ hibernate-commons-annotations >>>>> 59 │ Active │ 80 │ 5.2.8.Final │ hibernate-core >>>>> 60 │ Active │ 80 │ 1.0.0.Final │ hibernate-jpa-2.1-api >>>>> 61 │ Active │ 80 │ 5.2.8.Final │ hibernate-osgi >>>>> 62 │ Active │ 80 │ 2.0.3.Final │ Java Annotation Indexer >>>>> 63 │ Active │ 80 │ 3.3.0.Final │ JBoss Logging 3 >>>>> 65 │ Active │ 80 │ 1.9.2.1 │ Apache ServiceMix :: Bundles :: >>>>> jasypt >>>>> 66 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Config >>>>> 67 │ Active │ 80 │ 1.1.0 │ OPS4J Pax JDBC Pooling Support >>>>> Base >>>>> 68 │ Active │ 80 │ 1.0.0.201505202023 │ org.osgi:org.osgi.service.jdbc >>>>> 69 │ Active │ 80 │ 1.3.172 │ H2 Database Engine >>>>> 117 │ Active │ 80 │ 1.2.0 │ CDI APIs >>>>> 118 │ Active │ 80 │ 1.2 │ javax.transaction API >>>>> 119 │ Active │ 80 │ 1.1.1 │ Apache Aries Transaction >>>>> Blueprint >>>>> 120 │ Active │ 80 │ 2.1.0 │ Apache Aries Transaction >>>>> Blueprint >>>>> 121 │ Active │ 80 │ 1.3.3 │ Apache Aries Transaction Manager >>>>> 122 │ Active │ 80 │ 1.0.2 │ Apache Felix Coordinator Service >>>>> 123 │ Active │ 80 │ 1.0.0.2 │ Apache ServiceMix :: Bundles :: >>>>> javax.injec >>>>> >>>>> bundle:diag 124 >>>>> Unsatisfied Requirements: >>>>> [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)] >>>>> osgi.service; (osgi.jndi.service.name >>>>> <http://osgi.jndi.service.name/>=tasklist) >>>>> [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)] >>>>> osgi.contract; (&(osgi.contract=JavaJPA)(version=2.1.0)) >>>>> >>>>> >>>>> Any idea how to troubleshoot this problem? >>>>> >>>>> Best regards, >>>>> Alex soto >>>>> >>>>> >>>>> >>>> >>> >> > >