Hi again Christian,

You are right. If I provide a DataSource instead of an XADataSource it
works. I tested it quickly by using my <non-jta-data-source> as the
<jta-data-source>. Then things hooked up and I can access the database.

Now, the DataSource I use underneath is
an org.apache.derby.jdbc.EmbeddedDataSource (instead
of org.apache.derby.jdbc.EmbeddedXADataSource) so I guess XA transactions
won't work.

I didn't quite understand the documentation you referred to. Today I
publish two datasources:

*[javax.sql.DataSource]*
*----------------------*
* osgi.jndi.service.name <http://osgi.jndi.service.name> =
jdbc/filetransferhistorynojta*
* osgi.service.blueprint.compname = derbyDataSource*
* service.bundleid = 178*
* service.id <http://service.id> = 341*
* service.scope = bundle*
*Provided by :*
* Connect :: filetransfer-history-datasource (178)*
*Used by:*
* Apache Aries JPA container (38)*

*karaf@root()> service:list XADataSource*
*[javax.sql.XADataSource]*
*------------------------*
* osgi.jndi.service.name <http://osgi.jndi.service.name> =
jdbc/filetransferhistoryjta*
* osgi.service.blueprint.compname = derbyXADataSource*
* service.bundleid = 178*
* service.id <http://service.id> = 342*
* service.scope = bundle*
*Provided by :*
* Connect :: filetransfer-history-datasource (178)*

I do this with Blueprint (doesn't matter I guess).

Now, which one of them should I publish? I assume the DataSource.

If I install the pax-jdbc-pool-aries (is this the one you recommend?). I
now get:

*karaf@root()> service:list DataSource*
*[javax.sql.DataSource]*
*----------------------*
* osgi.jndi.service.name <http://osgi.jndi.service.name> =
jdbc/filetransferhistorynojta*
* osgi.service.blueprint.compname = derbyDataSource*
* service.bundleid = 178*
* service.id <http://service.id> = 332*
* service.scope = bundle*
*Provided by :*
* Connect :: filetransfer-history-datasource (178)*
*Used by:*
* Connect :: filetransfer-history-datasource (178)*
* Apache Aries JPA container (38)*

*[javax.sql.DataSource]*
*----------------------*
* aries.managed = true*
* osgi.jndi.service.name <http://osgi.jndi.service.name> =
jdbc/filetransferhistorynojta*
* osgi.service.blueprint.compname = derbyDataSource*
* service.bundleid = 178*
* service.id <http://service.id> = 410*
* service.ranking = 1000*
* service.scope = singleton*
*Provided by :*
* Connect :: filetransfer-history-datasource (178)*
*Used by:*
* Apache Aries JPA container (38)*

*[javax.sql.DataSource]*
*----------------------*
* aries.managed = true*
* aries.xa.aware = true*
* osgi.jndi.service.name <http://osgi.jndi.service.name> =
jdbc/filetransferhistoryjta*
* osgi.service.blueprint.compname = derbyXADataSource*
* service.bundleid = 178*
* service.id <http://service.id> = 415*
* service.ranking = 1000*
* service.scope = singleton*
*Provided by :*
* Connect :: filetransfer-history-datasource (178)*

*karaf@root()> service:list XADataSource*
*[javax.sql.XADataSource]*
*------------------------*
* osgi.jndi.service.name <http://osgi.jndi.service.name> =
jdbc/filetransferhistoryjta*
* osgi.service.blueprint.compname = derbyXADataSource*
* service.bundleid = 178*
* service.id <http://service.id> = 331*
* service.scope = bundle*
*Provided by :*
* Connect :: filetransfer-history-datasource (178)*
*Used by:*
* Connect :: filetransfer-history-datasource (178)*

What I do not understand is that I now have two services of each class but
the osgi.jndi.service.name hasn't changed. Which one will actually be used?
I thought the wrapper would have a different name (with "-pool" at the end)
and that name is what I would refer to in the persistence.xml.

I can see that two of the services have "service.ranking = 1000". Are these
the wrappers? Does the high rank ensure that it will be chosen instead of
changing the name?

/Bengt





2016-07-08 9:08 GMT+02:00 Christian Schneider <[email protected]>:

> You can have two DataSources in the persistence.xml but only one will be
> used. If you set *transaction-type="JTA" *
> then only the jta DataSource will be used. So this is not the problem.
>
> The problem is that you set an XADataSource
> *<jta-data-source>osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name
> <http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)</jta-data-source>*
>
> What you need is an OSGi service of type DataSource that internally wraps
> an XADataSource. This is a common pattern that also JEE servers use.
> The easiest way to achieve this is to use the config, pooling and XA
> support of pax-jdbc. See
>
> https://ops4j1.jira.com/wiki/display/PAXJDBC/Pooling+and+XA+support+for+DataSourceFactory
>
> Apart from that I think your setup looks good now.
>
> Could you open an issue in the karaf jira about the problems with the
> openjpa feature? I will fix it then for the next karaf version.
>
> Christian
>
>
> On 07.07.2016 16:18, Bengt Rodehav wrote:
>
> I assume that I cannot reference two datasources from my persistence.xml.
> I therefore removed the <non-jta-data-source>.
>
> This makes the JNDI problem go away.
>
> I now have a EntityManagerFactoryBuilder published as a service:
>
> *karaf@root()> service:list EntityManagerFactoryBuilder*
> *[org.osgi.service.jpa.EntityManagerFactoryBuilder]*
> *--------------------------------------------------*
> * osgi.unit.name <http://osgi.unit.name> = filetransferhistoryPU*
> * osgi.unit.provider =
> org.apache.openjpa.persistence.PersistenceProviderImpl*
> * osgi.unit.version = 2.8.0.SNAPSHOT*
> * service.bundleid = 38*
> * service.id <http://service.id> = 346*
> * service.scope = singleton*
> *Provided by :*
> * Apache Aries JPA container (38)*
>
> But no EntityManager or EntityManagerFactory:
>
>
> *karaf@root()> service:list EntityManagerFactory *
>
> *karaf@root()> service:list EntityManager *
>
> *karaf@root()>  *
>
> Which (after a while of "grace period") causes this:
>
> *2016-07-07 16:10:07,546 | ERROR | rint Extender: 1 |
> BlueprintContainerImpl           | ntainer.BlueprintContainerImpl$1  374 |
> Unable to start blueprint container for bundle
> se.digia.connect.services.filetransfer.history-db/2.8.0.SNAPSHOT due to
> unresolved dependencies [(&(osgi.unit.name
> <http://osgi.unit.name>=filetransferhistoryPU)(objectClass=javax.persistence.EntityManager))]*
> *java.util.concurrent.TimeoutException*
> * at
> org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:371)[24:org.apache.aries.blueprint.core:1.6.1]*
> * at
> org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[24:org.apache.aries.blueprint.core:1.6.1]*
> * at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_74]*
> * at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_74]*
> * at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_74]*
> * at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_74]*
> * at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_74]*
> * at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_74]*
> * at java.lang.Thread.run(Thread.java:745)[:1.8.0_74]*
>
>
> I feel like I'm getting closer but there is still something missing to get
> all the way to an EntityManager...
>
> /Bengt
>
>
>
>
>
>
>
>
>
>
>
> 2016-07-07 15:56 GMT+02:00 Bengt Rodehav <[email protected]>:
>
>> Both data sources are published:
>>
>> *karaf@root()> service:list DataSource*
>> *[javax.sql.DataSource]*
>> *----------------------*
>> * osgi.jndi.service.name <http://osgi.jndi.service.name> =
>> jdbc/filetransferhistorynojta*
>> * osgi.service.blueprint.compname = derbyDataSource*
>> * service.bundleid = 178*
>> * service.id <http://service.id> = 323*
>> * service.scope = bundle*
>> *Provided by :*
>> * Connect :: filetransfer-history-datasource (178)*
>>
>> *karaf@root()> service:list XADataSource*
>> *[javax.sql.XADataSource]*
>> *------------------------*
>> * osgi.jndi.service.name <http://osgi.jndi.service.name> =
>> jdbc/filetransferhistoryjta*
>> * osgi.service.blueprint.compname = derbyXADataSource*
>> * service.bundleid = 178*
>> * service.id <http://service.id> = 324*
>> * service.scope = bundle*
>> *Provided by :*
>> * Connect :: filetransfer-history-datasource (178)*
>>
>> The problem seems to be that I cannot refer to both of them in
>> persistence.xml...
>>
>> /Bengt
>>
>>
>> 2016-07-07 15:48 GMT+02:00 Bengt Rodehav < <[email protected]>
>> [email protected]>:
>>
>>> Interesting...
>>>
>>> I now changed the jpa feature to the following:
>>>
>>> *    <feature name="jpa" description="OSGi Persistence Container"
>>> version="2.3.0">*
>>> *        <details>JPA implementation provided by Apache Aries JPA 2.x.
>>> NB: this feature doesn't provide the JPA engine, you have to install one by
>>> yourself (OpenJPA for instance)</details>*
>>> *        <feature version="[1.1,2)" prerequisite="false"
>>> dependency="false">transaction-api</feature>*
>>> *        <bundle
>>> dependency="true">mvn:org.osgi/org.osgi.service.jpa/1.0.0</bundle>*
>>>
>>> *        <feature version="[2.0.0,2.1.0)" prerequisite="false"
>>> dependency="false">persistence-api</feature> *
>>>
>>> Which removed the previous error I had. But I now get JNDI problems:
>>>
>>> 2016-07-07 15:32:37,240 | ERROR | pool-7-thread-1  |
>>> BootFeaturesInstaller            | al.service.BootFeaturesInstaller  128 |
>>> Error installing boot features
>>> org.apache.karaf.features.internal.util.MultiException: Error restarting
>>> bundles
>>> at
>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:848)[9:org.apache.karaf.features.core:4.0.5]
>>> at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1152)[9:org.apache.karaf.features.core:4.0.5]
>>> at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1048)[9:org.apache.karaf.features.core:4.0.5]
>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_74]
>>> at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_74]
>>> at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_74]
>>> at java.lang.Thread.run(Thread.java:745)[:1.8.0_74]
>>> Caused by: org.osgi.framework.BundleException: Activator start error in
>>> bundle org.apache.aries.jpa.container [38].
>>> at
>>> org.apache.felix.framework.Felix.activateBundle(Felix.java:2276)[org.apache.felix.framework-5.4.0.jar:]
>>> at
>>> org.apache.felix.framework.Felix.startBundle(Felix.java:2144)[org.apache.felix.framework-5.4.0.jar:]
>>> at
>>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.4.0.jar:]
>>> at
>>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)[org.apache.felix.framework-5.4.0.jar:]
>>> at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1262)[9:org.apache.karaf.features.core:4.0.5]
>>> at
>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:840)[9:org.apache.karaf.features.core:4.0.5]
>>> ... 6 more
>>> Caused by: java.lang.IllegalArgumentException:
>>> org.osgi.framework.InvalidSyntaxException: Only one top-level operation
>>> allowed: (&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name
>>> =osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name
>>> =jdbc/filetransferhistoryjta)))
>>> at
>>> org.apache.aries.jpa.container.impl.DataSourceTracker.createFilter(DataSourceTracker.java:64)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.aries.jpa.container.impl.DataSourceTracker.<init>(DataSourceTracker.java:46)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.createDataSourceTracker(PersistenceProviderTracker.java:120)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:87)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:106)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:90)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:69)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:40)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)[org.osgi.core-6.0.0.jar:]
>>> at
>>> org.apache.aries.jpa.container.impl.Activator.start(Activator.java:43)[38:org.apache.aries.jpa.container:2.3.0]
>>> at
>>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)[org.apache.felix.framework-5.4.0.jar:]
>>> at
>>> org.apache.felix.framework.Felix.activateBundle(Felix.java:2226)[org.apache.felix.framework-5.4.0.jar:]
>>> ... 11 more
>>> Caused by: org.osgi.framework.InvalidSyntaxException: Only one top-level
>>> operation allowed: (&(objectClass=javax.sql.DataSource)(
>>> osgi.jndi.service.name=osgi:service/javax.sql.XADataSource/(
>>> osgi.jndi.service.name=jdbc/filetransferhistoryjta)))
>>> at
>>> org.apache.felix.framework.FilterImpl.<init>(FilterImpl.java:51)[org.apache.felix.framework-5.4.0.jar:]
>>> at
>>> org.apache.felix.framework.BundleContextImpl.createFilter(BundleContextImpl.java:134)[org.apache.felix.framework-5.4.0.jar:]
>>> at
>>> org.apache.aries.jpa.container.impl.DataSourceTracker.createFilter(DataSourceTracker.java:62)[38:org.apache.aries.jpa.container:2.3.0]
>>> ... 33 more
>>>
>>> It seems like the JNDI search has two top-level operations which doesn't
>>> seem to be allowed. Looking at the exception it looks like one top level
>>> operation to me. The operation is "&" ("and") and the two expressions that
>>> should be "anded" together are:
>>>
>>>
>>> *(objectClass=javax.sql.DataSource) *
>>>
>>> and
>>>
>>>
>>> *(osgi.jndi.service.name
>>> <http://osgi.jndi.service.name>=osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name
>>> <http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)) *
>>>
>>> But the second expression looks a bit fishy to me although I'm not a
>>> JNDI expert.
>>>
>>>
>>> I assume the expressions has its origins in my persistence.xml:
>>>
>>> *<?xml version="1.0" encoding="UTF-8"?>*
>>> *<persistence xmlns="http://java.sun.com/xml/ns/persistence
>>> <http://java.sun.com/xml/ns/persistence>"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>>> <http://www.w3.org/2001/XMLSchema-instance>"*
>>> *  xsi:schemaLocation="
>>> <http://java.sun.com/xml/ns/persistence>http://java.sun.com/xml/ns/persistence
>>> <http://java.sun.com/xml/ns/persistence>
>>> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd
>>> <http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd>"*
>>> *  version="2.0">*
>>> *  <persistence-unit name="filetransferhistoryPU"
>>> transaction-type="JTA">*
>>> *
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>*
>>> *
>>> <jta-data-source>osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name
>>> <http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)</jta-data-source>*
>>> *
>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
>>> <http://osgi.jndi.service.name>=jdbc/filetransferhistorynojta)</non-jta-data-source>*
>>> *    <class>se.digia.connect.filetransfer.history.domain.Entry</class>*
>>> *
>>> <class>se.digia.connect.filetransfer.history.domain.FileEntry</class>*
>>> *    <class>se.digia.connect.filetransfer.history.domain.Retry</class>*
>>> *    <class>se.digia.connect.util.persistence.EntityBase</class>*
>>> *    <exclude-unlisted-classes>true</exclude-unlisted-classes>*
>>> *    <validation-mode>NONE</validation-mode>*
>>> *    <properties>*
>>> *      <property name="openjpa.ConnectionFactoryMode" value="managed" />*
>>> *      <property name="openjpa.jdbc.SynchronizeMappings"
>>> value="buildSchema(ForeignKeys=true)" />*
>>> *      <property name="openjpa.jdbc.DBDictionary" value="derby" />*
>>> *      <property name="openjpa.jdbc.UpdateManager"
>>> value="operation-order" />*
>>> *      <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"
>>> />*
>>> *    </properties>*
>>> *  </persistence-unit>*
>>> *</persistence>*
>>>
>>> I have both a <jta-data-source> and a <non-jta-data-source>. Is that not
>>> supported anymore?
>>>
>>> /Bengt
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> 2016-07-07 15:28 GMT+02:00 Bengt Rodehav < <[email protected]>
>>> [email protected]>:
>>>
>>>> OK - I'll try.
>>>>
>>>> Thanks,
>>>>
>>>> /Bengt
>>>>
>>>> 2016-07-07 15:22 GMT+02:00 Christian Schneider <
>>>> <[email protected]>[email protected]>:
>>>>
>>>>> Hmm this could actually explain the problems we see. I always wondered
>>>>> why karaf insists to install the 2.1 version of the jpa spec bundle but
>>>>> this explains it.
>>>>>
>>>>> Luckily this should be easy to solve. Try to install the OSGi jpa spec
>>>>> bundle:
>>>>>
>>>>> http://search.maven.org/#artifactdetails%7Corg.osgi%7Corg.osgi.service.jpa%7C1.0.0%7Cjar
>>>>>
>>>>> It should contain exactly the missing package. I think we are missing
>>>>> this bundle in the feature. We just did not see it as it is embeded in the
>>>>> jpa 2.1 spec bundle we use.
>>>>> You could also try to simply add this bundle to the persistence-api
>>>>> 2.0.0 feature. Maybe then karaf already does the right thing.
>>>>>
>>>>> Christian
>>>>>
>>>>>
>>>>> On 07.07.2016 15:04, Bengt Rodehav wrote:
>>>>>
>>>>>
>>>>> It seems like the or.apache.aries.jpa.container requires the package
>>>>> org.osgi.service.jpa (at least version 1.0.0) and that package is only
>>>>> provided by the JPA 2.1 bundle...
>>>>>
>>>>> Hope you understand this a bit better than me but it does not seem to
>>>>> be easy to come up with a working solution including OpenJPA 2.4.1 in 
>>>>> Karar
>>>>> 4.0.5. If you have a workaround to try before you get a fix inte Karaf
>>>>> 4.0.6 I would be grateful.
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>>
>>>>> 2016-07-07 14:17 GMT+02:00 Bengt Rodehav < <[email protected]>
>>>>> [email protected]>:
>>>>>
>>>>>> OK - thanks a lot for all your help Christian.
>>>>>>
>>>>>> /Bengt
>>>>>>
>>>>>>
>>>>>> 2016-07-07 14:14 GMT+02:00 Christian Schneider <
>>>>>> <[email protected]>[email protected]>:
>>>>>>
>>>>>>> Genereally Aries JPA should work with OpenJPA 2.4.1 but I think
>>>>>>> there is some bug in karaf 4.0.5.
>>>>>>>
>>>>>>> I just tested again and found that persistence api 2.0 and 2.1 are
>>>>>>> both installed. This fails as Aries JPA can only bind to one of these 
>>>>>>> and
>>>>>>> will choose the higher version.
>>>>>>> As a workaround you should be able to create your own feature copied
>>>>>>> from the Aries JPA feature but make sure you install the persistence api
>>>>>>> only in version 2.0.
>>>>>>>
>>>>>>> I will try to create a working version of the features for karaf
>>>>>>> 4.0.6.
>>>>>>>
>>>>>>> Christian
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 07.07.2016 14:07, Bengt Rodehav wrote:
>>>>>>>
>>>>>>> Installing feature "openjpa" also installs JPA 2.0 (version 1.1) so
>>>>>>> I shouldn't need to install JPA manually as well. However, then I won't 
>>>>>>> get
>>>>>>> the Aries support for JPA. Feels a bit weird.
>>>>>>>
>>>>>>> What Aries JPa version should be used together with OpenJPA 2.4.1?
>>>>>>>
>>>>>>> /Bengt
>>>>>>>
>>>>>>> 2016-07-07 14:04 GMT+02:00 Bengt Rodehav < <[email protected]>
>>>>>>> [email protected]>:
>>>>>>>
>>>>>>>> It seems to be the "jpa" feature that installs JPA 2.1.
>>>>>>>>
>>>>>>>> 2016-07-07 13:58 GMT+02:00 Bengt Rodehav < <[email protected]>
>>>>>>>> [email protected]>:
>>>>>>>>
>>>>>>>>> On a fresh Karaf 4.0.5 I do:
>>>>>>>>>
>>>>>>>>> *la | grep -i jpa*
>>>>>>>>> *la | grep -i persistence*
>>>>>>>>>
>>>>>>>>> Nothing is displayed. I then do:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *feature:install openjpa jpa *
>>>>>>>>>
>>>>>>>>> If I then execute the above commands I get:
>>>>>>>>>
>>>>>>>>> *karaf@root()> la | grep -i jpa*
>>>>>>>>> *62 | Active   |  80 | 2.3.0               | Apache Aries JPA
>>>>>>>>> Container API*
>>>>>>>>> *63 | Active   |  80 | 2.3.0               | Apache Aries JPA
>>>>>>>>> blueprint*
>>>>>>>>> *64 | Active   |  80 | 2.3.0               | Apache Aries JPA
>>>>>>>>> container*
>>>>>>>>> *65 | Active   |  80 | 2.3.0               | Apache Aries JPA
>>>>>>>>> support*
>>>>>>>>> *71 | Active   |  80 | 1.1                 | Apache Geronimo
>>>>>>>>> JSR-317 JPA 2.0 Spec AP*
>>>>>>>>> *73 | Active   |  80 | 2.4.1               | OpenJPA Aggregate Jar*
>>>>>>>>> *karaf@root()> la | grep -i persistence*
>>>>>>>>> *55 | Active   |  80 | 2.1.0.v201304241213 | Java Persistence API
>>>>>>>>> 2.1*
>>>>>>>>> *karaf@root()>*
>>>>>>>>>
>>>>>>>>> So JPA 2.1 has indeed been installed. I don't know if this is why
>>>>>>>>> I have problems but it still seems strange.
>>>>>>>>>
>>>>>>>>> /Bengt
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 2016-07-07 13:11 GMT+02:00 Christian Schneider <
>>>>>>>>> <[email protected]>[email protected]>:
>>>>>>>>>
>>>>>>>>>> Can you start from an empty karaf 4.0.5 and then do
>>>>>>>>>>
>>>>>>>>>> feature:install openjpa jpa
>>>>>>>>>>
>>>>>>>>>> This should install openjpa 2.4.1 and aries jpa 2.3.0 with
>>>>>>>>>> javax.persistence 2.0 and jta 1.2.
>>>>>>>>>>
>>>>>>>>>> This configuration should work. So maybe something else you
>>>>>>>>>> install requires the jpa 2.1 spec.
>>>>>>>>>>
>>>>>>>>>> Christian
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 07.07.2016 10:28, Bengt Rodehav wrote:
>>>>>>>>>>
>>>>>>>>>> Reading your post again Christian I realize that I should not use
>>>>>>>>>> JPA 2.1 but JPA 2.0.
>>>>>>>>>>
>>>>>>>>>> I seem to have JPA 2.0 and JPA 2.1 installed at runtime:
>>>>>>>>>>
>>>>>>>>>> *karaf@root()> la | grep -i jpa*
>>>>>>>>>> * 37 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>>>>>>> Container API*
>>>>>>>>>> * 38 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>>>>>>> blueprint*
>>>>>>>>>> * 39 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>>>>>>> container*
>>>>>>>>>> * 40 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>>>>>>> support*
>>>>>>>>>> * 70 | Active   |  80 | 1.1                   | Apache Geronimo
>>>>>>>>>> JSR-317 JPA 2.0 Spec API*
>>>>>>>>>> *106 | Active   |  80 | 2.4.1                 | OpenJPA Aggregate
>>>>>>>>>> Jar*
>>>>>>>>>> *karaf@root()> la | grep -i persistence*
>>>>>>>>>> * 17 | Active   |  80 | 2.1.0.v201304241213   | Java Persistence
>>>>>>>>>> API 2.1*
>>>>>>>>>> *175 | Active   |  80 | 2.8.0.SNAPSHOT        | Connect ::
>>>>>>>>>> persistence-util*
>>>>>>>>>>
>>>>>>>>>> I don't really know why the JPA version 2.1 (2.1.0.v201304241213)
>>>>>>>>>> is being installed. I do not do this explicitly.
>>>>>>>>>>
>>>>>>>>>> Looking at OpenJPA 2.4.1, it seems to depend on JTA 1.1 not JTA
>>>>>>>>>> 1.2.
>>>>>>>>>>
>>>>>>>>>> Looked again at my JPA version. I do use JPA 2.0. But I use
>>>>>>>>>> version 1.1 of artifact geronimo-jpa_2.0_spec which caused me to 
>>>>>>>>>> believe I
>>>>>>>>>> was using JPA 1.1....
>>>>>>>>>>
>>>>>>>>>> I'm still kind of confused. It would be thankful if you could
>>>>>>>>>> tell me what features (and versions of those features) I should 
>>>>>>>>>> install in
>>>>>>>>>> order to use the latest version (2.4.1) of OpenJPA.
>>>>>>>>>>
>>>>>>>>>> /Bengt
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Christian Schneiderhttp://www.liquid-reality.de
>>>>>>>>>>
>>>>>>>>>> Open Source Architecthttp://www.talend.com
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Christian Schneiderhttp://www.liquid-reality.de
>>>>>>>
>>>>>>> Open Source Architecthttp://www.talend.com
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Christian Schneiderhttp://www.liquid-reality.de
>>>>>
>>>>> Open Source Architecthttp://www.talend.com
>>>>>
>>>>>
>>>>
>>>
>>
>
>
> --
> Christian Schneiderhttp://www.liquid-reality.de
>
> Open Source Architecthttp://www.talend.com
>
>

Reply via email to