From user-return-18590-archive-asf-public=cust-asf.ponee.io@karaf.apache.org Fri May 18 17:51:07 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8591718076D for ; Fri, 18 May 2018 17:51:05 +0200 (CEST) Received: (qmail 11504 invoked by uid 500); 18 May 2018 15:51:04 -0000 Mailing-List: contact user-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@karaf.apache.org Delivered-To: mailing list user@karaf.apache.org Received: (qmail 11494 invoked by uid 99); 18 May 2018 15:51:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 May 2018 15:51:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id CF3FFC6FF3 for ; Fri, 18 May 2018 15:51:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.971 X-Spam-Level: * X-Spam-Status: No, score=1.971 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, KAM_SHORT=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_DKIMWL_WL_MED=-0.01] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=envieta-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id lolS35XZp2Er for ; Fri, 18 May 2018 15:50:59 +0000 (UTC) Received: from mail-qt0-f169.google.com (mail-qt0-f169.google.com [209.85.216.169]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 529EC5F2C4 for ; Fri, 18 May 2018 15:50:59 +0000 (UTC) Received: by mail-qt0-f169.google.com with SMTP id j42-v6so10814661qtj.12 for ; Fri, 18 May 2018 08:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envieta-com.20150623.gappssmtp.com; s=20150623; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=Vc+1vvRAfvK984wlwc1RNS4afEXrKLqXfqjjA7tu+tM=; b=IZEKXG3oQp5TLHJ2eUyUSQV81gO4b7AZhmdcL9luetd3CvbUTvW3VZd9aawbaW24Np BvFwDEH+hIj+Wdu6Ovl+cIOSMyaw+PjqXbS2G6yBhKbDoXN1UFiaZX96XvDuTnEra7iD aeovZrQpX6LZbomPRQCocrrGkuWVrOY8aBzTn8ALOVKCJ20ttlSD75djWjaj0dLVrI1J Mhmpc2Ax3VJt1Yb6N3OVqjg+hHvKy4hxGRLboaYpDU3kf5Dt78gpwmB50on7LWlqIt+7 CdOLnAIpL2kXPvbeTbBcfOTAPV6F3MKX/lXzG4uPVWUYlAxgFvZ1HkaaYJL2ueIpsx6h LDzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=Vc+1vvRAfvK984wlwc1RNS4afEXrKLqXfqjjA7tu+tM=; b=j54o/GhZy+t8MsljsjfwvFkCr9yGw5oK5GxzwmeZ0Tb+7dyf+erWc6qebJyLu/uiOn NZygXf8qgQ0Z0OHquCsNGoM+HiKGCHfjejl7okMWOJbDGTkW0iuC3ZkYSB8VIL1YpOl5 5oVOdeGeN+aQkTT+UcCKXBRnqE/IAuPQweWDLSmKjPdqdf4L79EfA1epNkG2SKgU1kka JIbaU/wg7qIc61mdICIt5nd/v/Ak1DPJpDS2Rd+W/naOu8LDO0eIiIfthvLD/VyQ6JtP 6FG+it9YnQhxRq6POkNjnJvRHEjjpdrHn0IIpP2V5EIIzkUDvmX0FYSqPEX4RcVh0gFf WXcw== X-Gm-Message-State: ALKqPwe+SUF3mMQaz7kRWoYRnLOhetdrKu1zzYOezI0BkzgME32jaWEs Oh4e7IrLvQ1xkoZ/vnKZEZ3lSyNfSfRXK9GT4wLWoKu2f3bBVpxM5nd44PxpluW3KOFMh6hSBVZ fevyVFugF9O7z1Ig4lFM9TLwvS2/Hs7H8heXHSMC2ugHIrc8vlUUgbrb6zBKSd0IHSvpb X-Google-Smtp-Source: AB8JxZpj3w/Iv7aSZMahsWzB5EHtc5lHqh9rCrt5LtIHMZoJSPxek8Z33ns9PEhrC8gcwjjx4Vf/Qg== X-Received: by 2002:ac8:2e38:: with SMTP id r53-v6mr9511892qta.8.1526658652205; Fri, 18 May 2018 08:50:52 -0700 (PDT) Received: from [10.0.0.239] (pool-71-121-235-201.bltmmd.fios.verizon.net. [71.121.235.201]) by smtp.gmail.com with ESMTPSA id t128-v6sm5285405qkh.48.2018.05.18.08.50.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 08:50:51 -0700 (PDT) From: Alex Soto Content-Type: multipart/alternative; boundary="Apple-Mail=_CDC83295-3A1D-462C-BC9E-130F40ACF526" Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: MariaDB/JPA Transaction rollback not working Date: Fri, 18 May 2018 11:50:50 -0400 References: <6089032d-9efa-3243-fe21-e0f0033a4d04@nanthrax.net> <5643B995-B9F1-4E79-A5AB-8D8AC66F6BEB@envieta.com> <811b01ee-5b74-e294-d20f-89954661e415@nanthrax.net> <25A180D1-73AD-463A-8A52-4EBF81A65B28@paremus.com> <635DC926-FFBB-434D-BF45-2CB980954005@paremus.com> <975389E7-1766-42D8-A42D-F096EFFBF408@envieta.com> <821F4411-4742-45D6-8AB5-893D1FC27A9E@paremus.com> <9D1A9178-39AD-4F6F-876D-8AFA838377FE@paremus.com> <553CFABC-6C09-4990-9E33-3C5D2527FA2E@envieta.com> <75DE775F-7D76-40D5-86CA-9F5EC6FDBB1E@paremus.com> <08BE597F-CC91-4EA6-91D5-FFAA39486414@envieta.com> <97F07745-ECC4-4FF9-AAA7-7E62456FF774@paremus.com> To: user@karaf.apache.org In-Reply-To: <97F07745-ECC4-4FF9-AAA7-7E62456FF774@paremus.com> Message-Id: <17788AF1-FAC8-4DD9-B19C-3DC2C03AF671@envieta.com> X-Mailer: Apple Mail (2.3445.6.18) --Apple-Mail=_CDC83295-3A1D-462C-BC9E-130F40ACF526 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Great, I solved the Eclipse problem. Thanks. Yes, Karaf provides DS 1.3, but no DS 1.4 out off the box. Maybe this is available from Aries? Best regards, Alex soto > On May 18, 2018, at 11:18 AM, Tim Ward wrote: >=20 > Hi, >=20 > Answers inline: >=20 > Sent from my iPhone >=20 > On 18 May 2018, at 16:55, Alex Soto > wrote: >=20 >> Thank you Tim for the very detailed explanation. >> There are two problems I don=E2=80=99t know how to resolve: >>=20 >> 1- BND generates this for my bundle:=20 >>=20 >> Require-Capability: = osgi.extender;filter:=3D"(&(osgi.extender=3Dosgi.component)(version>=3D1.3= .0)(!(version>=3D2.0.0)))=E2=80=9D >>=20 >> This is because I use the @Component and @Reference annotations. = This is strange, since I should be using OSGi R7, so I am not sure why = it is saying 1.3.0. Now when try to run in Karaf, even though I am = installing scr feature, it fails with unresolved requirement. >=20 > So in the absence of information to the contrary this requirement is = added based on your usage of Declarative Services features. If you use = DS 1.3 features then DS 1.3 will be required.=20 >=20 > Since R7 added the bundle requirement annotations the @Component = annotation has been annotated to require DS at the current spec version = (this gives a more consistent behaviour than bnd=E2=80=99s heuristics). = At a guess you are picking up a 1.3 requirement because you have the 1.3 = annotations ahead of the 1.4 annotations on your classpath, but it could = be triggered by other things too. On the other hand this isn=E2=80=99t = actually a problem as the requirement is still satisfied by DS 1.4 and = both versions will work for you at runtime. >=20 > The Karaf scr feature really should be providing SCR 1.3 (which is = required by the spec to provide the extender capability. That has been = the current version of the spec for three years, and has been provided = by Felix for at least 6 releases. I=E2=80=99d be pretty shocked if DS = 1.3 wasn=E2=80=99t supported. You may need help from a more Karaf = focussed person to confirm this.=20 >=20 >>=20 >> Since I could not find OSGi R7 in public Maven Repos, I followed = EnRoute depending on: >> >> org.osgi.enroute >> osgi-api >> 7.0.0-SNAPSHOT >> pom >> provided >> >> >> org.osgi.enroute >> enterprise-api >> 7.0.0-SNAPSHOT >> pom >> provided >> >=20 > There=E2=80=99s no problem with you using these. On the other hand the = OSGi API aggregations you are looking for are:=20 >=20 > https://mvnrepository.com/artifact/org.osgi/osgi.core = >=20 > https://mvnrepository.com/artifact/org.osgi/osgi.cmpn = >=20 > You can also find the individual specs under the org.osgi group id if = you want to use a smaller hammer :) >=20 >>=20 >> 2- This is minor, and I see it also in the EnRoute project. While the = Maven build succeeds, Eclipse BND plugin shows 2 errors: >>=20 >> The default package '.' is not permitted by the Import-Package = syntax. This can be caused by compile errors in Eclipse because Eclipse = creates valid class files regardless of compile errors. The following = package(s) import from the default package = [org.enquery.encryptedquery.responder.data.service.impl] = (biz.aQute.bnd:bnd-maven-plugin:4.0.0:bnd-process:default:process-classes)= pom.xml /encryptedquery-responder-data line 0 Maven Build = Participant Problem=20 >>=20 >> The project was not built since its build path is incomplete. Cannot = find the class file for javax.persistence.EntityManager. Fix the build = path then try building this project encryptedquery-responder-data = Unknown Java Problem >>=20 >> =20 >=20 > As the message suggests, this usually occurs when Eclipse has build = errors for the project. Specifically in this case you seem to be = building against a project which exposes the EntityManager interface = somehow, but you don=E2=80=99t have the JPA API in your compile = dependencies (normally these would come come in transitively from the = project you depend on).=20 >=20 > I hope this helps, >=20 > Tim >=20 >>=20 >>=20 >> Best regards, >> Alex soto >>=20 >>=20 >>=20 >>=20 >>> On May 18, 2018, at 5:23 AM, Tim Ward > wrote: >>>=20 >>> Hi Alex, >>>=20 >>> The bundles you need are listed in the bndrun for the JPA version of = the enRoute application, but as I think you=E2=80=99re using OpenJPA = (rather than Hibernate) it may help to explain things in relation to the = Transaction Control JPA integration test for OpenJPA. I=E2=80=99m sure = that at least some of this will be stuff you already know, but I=E2=80=99m= trying to make sure I give a compete explanation.=20 >>>=20 >>> This method defines some extra properties to add to the persistence = unit. It references a couple of open bugs in OpenJPA which may or may = not affect you. It also adds schema generation as OpenJPA does not = support the standard properties from JPA 2.1 = https://github.com/apache/aries-tx-control/blob/master/tx-control-provider= s/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/ites= ts/SimpleOpenJPA_2_4_1_Test.java#L34 = >>>=20 >>> This method defines the OpenJPA bundles and their immediate = dependencies. = https://github.com/apache/aries-tx-control/blob/master/tx-control-provider= s/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/ites= ts/SimpleOpenJPA_2_4_1_Test.java#L48 = >>>=20 >>> You then need: >>>=20 >>> =E2=80=A2 Aries JPA 2.7.0 - this provides the OSGi JPA Service 1.1 = RI (1.1 features are needed by the Aries Tx Control JPA resource = provider to support XA) >>>=20 >>> =E2=80=A2 Aries Tx Control Service - either XA or local depending on = whether you need XA Transaction support. For example = https://github.com/apache/aries-tx-control/blob/master/tx-control-provider= s/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/ites= ts/AbstractJPATransactionTest.java#L365 = >>>=20 >>> =E2=80=A2 Aries Tx Control JPA resource provider - either XA or = local depending on your needs. Note that you can=E2=80=99t use the XA = provider with the local service, but you can use the local provider with = the XA service (although this doesn=E2=80=99t make a lot of sense to = do). For example = https://github.com/apache/aries-tx-control/blob/master/tx-control-provider= s/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/ites= ts/AbstractJPATransactionTest.java#L377 = >>>=20 >>> =E2=80=A2 A JDBC Service implementation supporting your database = driver. H2 supports this natively (which is why it is used in many = examples) but MariaDB does not. Therefore you will need to deploy = PAX-JDBC=E2=80=99s support. See = https://github.com/ops4j/org.ops4j.pax.jdbc/tree/master/pax-jdbc-mariadb = = >>>=20 >>> You then have the option of either programmatically assembling your = Resource Provider, or using configuration. Configuration is generally = easier and is what I normally recommend. At that point you need to = create a factory configuration for the relevant PID (it depends on = whether you use the local or XA resource provider, see = https://github.com/apache/aries-tx-control/blob/master/tx-control-provider= s/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/ites= ts/AbstractJPATransactionTest.java#L175 = ) >>>=20 >>> The necessary configuration properties are: >>>=20 >>> =E2=80=A2 url - the JDBC URL for your database=20 >>> =E2=80=A2 osgi.jdbc.driver.class - the database driver class name, = in your case org.mariadb.jdbc.Driver >>> =E2=80=A2 osgi.unit.name - the name of your persistence unit=20 >>>=20 >>> The result of this configuration will be a JPAEntityManagerProvider = service registered in the service registry (using your = EntityManagerFactoryBuilder and the MariaDB DataSourceFactory). You can = then Inject that service into your code and combine it with the = TransactionControl service to make a thread safe EntityManager that you = can use in all your requests (just like the enRoute example does).=20 >>>=20 >>> I hope this helps, >>>=20 >>> Tim >>>=20 >>> Sent from my iPhone >>>=20 >>> On 17 May 2018, at 22:46, Alex Soto > wrote: >>>=20 >>>> Thanks Tim,=20 >>>>=20 >>>> I was using branch R7, changed to master, it builds now. >>>>=20 >>>> Now I have updated my project to OSGi 7 with Transaction Control, = how do I deploy to Karaf? >>>> i.e., what bundles/features do I need? >>>>=20 >>>>=20 >>>> Best regards, >>>> Alex soto >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>>> On May 17, 2018, at 2:08 PM, Tim Ward > wrote: >>>>>=20 >>>>> Hi Alex, >>>>>=20 >>>>> Bnd 4.0.0 was only released last Sunday, but this should have been = changed yesterday in this commit = https://github.com/osgi/osgi.enroute/commit/9f9857c3d317cd08a7aaf7327c1904= 676299f9ee = to make sure enRoute kept building.=20 >>>>>=20 >>>>> EnRoute is automatically pushed to the sonatype OSGi nexus = repository, so is it possible that you=E2=80=99re running offline, or = firewalled from the repo? You should be able to force snapshot updates = from the Maven command line.=20 >>>>>=20 >>>>> Best Regards, >>>>>=20 >>>>> Tim >>>>>=20 >>>>> Sent from my iPhone >>>>>=20 >>>>> On 17 May 2018, at 18:26, Alex Soto > wrote: >>>>>=20 >>>>>> Allright, I am trying to follow the EnRoute tutorial. >>>>>>=20 >>>>>> I am getting this error: >>>>>>=20 >>>>>> [ERROR] Plugin biz.aQute.bnd:bnd-maven-plugin:4.0.0-SNAPSHOT or = one of its dependencies could not be resolved: Could not find artifact = biz.aQute.bnd:bnd-maven-plugin:jar:4.0.0-SNAPSHOT in Bnd Snapshots = (https://bndtools.ci.cloudbees.com/job/bnd.master/lastSuccessfulBuild/arti= fact/dist/bundles/ = ) -> [Help 1] >>>>>>=20 >>>>>>=20 >>>>>> Any idea (time frame) when this will move from SNAPSHOT = dependencies? >>>>>>=20 >>>>>>=20 >>>>>> Best regards, >>>>>> Alex soto >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>> On May 17, 2018, at 11:08 AM, Tim Ward > wrote: >>>>>>>=20 >>>>>>> It is highly unlikely that you=E2=80=99ll hit the same issues. = The transaction control resource provider uses the DataSourceFactory = directly to create a DataSource (either progamatically using a factory = service or via config admin) that enlists itself in the ongoing = transaction. This means that the answer to your question is =E2=80=9Cwith = Transaction Control you don=E2=80=99t have to do that because it does it = automatically=E2=80=9D >>>>>>>=20 >>>>>>> If you want to use XA transactions then the only requirement is = that the DataSourceFactory can produce an XADataSource, otherwise it = just uses the standard JDBC API to commit/rollback. If your = DataSourceFactory doesn=E2=80=99t support XA then use the local resource = provider implementation. >>>>>>>=20 >>>>>>> Best Regards, >>>>>>>=20 >>>>>>> Tim >>>>>>>=20 >>>>>>> Sent from my iPhone >>>>>>>=20 >>>>>>> On 17 May 2018, at 15:17, Alex Soto > wrote: >>>>>>>=20 >>>>>>>> I will take a look at these examples. >>>>>>>>=20 >>>>>>>> However, I think that if I cannot get a MariaDB DataSource that = supports transactions, then it will still not work, right? >>>>>>>> If the examples use H2 database, I still may get different = results when I change to MariaDB, and I will find myself in the same = spot as of now. >>>>>>>>=20 >>>>>>>> So, the question remains about what is the correct way how to = register a transaction aware MariaDB DataSource. >>>>>>>>=20 >>>>>>>>=20 >>>>>>>> Best regards, >>>>>>>> Alex soto >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>> On May 17, 2018, at 1:46 AM, Tim Ward > wrote: >>>>>>>>>=20 >>>>>>>>> The best place to start when looking for OSGi R7 examples is = the enRoute Project. It contains Maven Archetypes, examples and worked = tutorials for building applications using R7 specifications.=20 >>>>>>>>>=20 >>>>>>>>> https://enroute.osgi.org >>>>>>>>>=20 >>>>>>>>> Most of the projects in use are just new versions of long = established OSGi implementations from Aries and Felix. The majority of = them are already released and in Maven Central. Those that are still in = the process of releasing (pretty much just the JAX-RS whiteboard) are = available in the Apache Snapshots repository. I am not aware of any = implementations that require R7 framework features, so all of them = should run on Karaf. >>>>>>>>>=20 >>>>>>>>> Best Regards, >>>>>>>>>=20 >>>>>>>>> Tim >>>>>>>>>=20 >>>>>>>>> Sent from my iPhone >>>>>>>>>=20 >>>>>>>>> On 16 May 2018, at 22:25, Alex Soto > wrote: >>>>>>>>>=20 >>>>>>>>>> I agree, it s very frustrating and time consuming. Almost = impossible to get it right. >>>>>>>>>> I may try the OSGi R7, but I am not sure of its adoption = level at this time, availability of bundles, examples, support by Karaf, = etc. >>>>>>>>>>=20 >>>>>>>>>>=20 >>>>>>>>>> Anyway, back to my current stack. I only see one DataSource = being registered: >>>>>>>>>>=20 >>>>>>>>>> karaf@root()> service:list DataSource >>>>>>>>>> [javax.sql.DataSource] >>>>>>>>>> ---------------------- >>>>>>>>>> databaseName =3D responder >>>>>>>>>> dataSourceName =3D responder >>>>>>>>>> osgi.jdbc.driver.name =3D mariadb >>>>>>>>>> osgi.jndi.service.name =3D responder >>>>>>>>>> service.bundleid =3D 14 >>>>>>>>>> service.factoryPid =3D org.ops4j.datasource >>>>>>>>>> service.id =3D 194 >>>>>>>>>> service.pid =3D = org.ops4j.datasource.feb33f6d-dc46-4bc7-a417-ad6bdd5a6ee5 >>>>>>>>>> service.scope =3D singleton >>>>>>>>>> url =3D jdbc:mariadb:XXXXXX >>>>>>>>>> Provided by :=20 >>>>>>>>>> OPS4J Pax JDBC Config (14) >>>>>>>>>> Used by:=20 >>>>>>>>>> Data (135) >>>>>>>>>>=20 >>>>>>>>>>=20 >>>>>>>>>> Not sure what to do with this. =20 >>>>>>>>>> I specified the following in the configuration: >>>>>>>>>>=20 >>>>>>>>>> pool=3Dnarayana >>>>>>>>>> xa=3Dtrue >>>>>>>>>>=20 >>>>>>>>>> Best regards, >>>>>>>>>> Alex soto >>>>>>>>>>=20 >>>>>>>>>>=20 >>>>>>>>>>=20 >>>>>>>>>>=20 >>>>>>>>>>> On May 16, 2018, at 4:12 PM, Tim Ward > wrote: >>>>>>>>>>>=20 >>>>>>>>>>> The structure of the JNDI name is defined by the JNDI = service specification.=20 >>>>>>>>>>>=20 >>>>>>>>>>> osgi:service/[/] >>>>>>>>>>>=20 >>>>>>>>>>> So in this case both of your services should be DataSource = instances, but they should have different filters.=20 >>>>>>>>>>>=20 >>>>>>>>>>> The important thing is to make sure you have an JTA = enlisting DataSource registered as a service (this isn=E2=80=99t just = your normal DataSource), then to build a filter which selects that. One = option for this is to use the enlistment whiteboard from Aries (not well = documented) = https://github.com/apache/aries/tree/trunk/transaction/transaction-jdbc = >>>>>>>>>>>=20 >>>>>>>>>>> This is a non-trivial thing to do, which is why I keep = mentioning Transaction Control which handles the enlistment reliably = without the layers of services.=20 >>>>>>>>>>>=20 >>>>>>>>>>> Best Regards, >>>>>>>>>>>=20 >>>>>>>>>>> Tim >>>>>>>>>>>=20 >>>>>>>>>>> Sent from my iPhone >>>>>>>>>>>=20 >>>>>>>>>>> On 16 May 2018, at 21:57, Alex Soto > wrote: >>>>>>>>>>>=20 >>>>>>>>>>>> Thank you Tim. >>>>>>>>>>>>=20 >>>>>>>>>>>> Any idea what the JNDI names would be? >>>>>>>>>>>> It is Pax-JDBC creating these JNDI names, so I have no = idea. >>>>>>>>>>>>=20 >>>>>>>>>>>> =46rom the Karaf console: >>>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>> karaf@root()> jndi:names=20 >>>>>>>>>>>> JNDI Name =E2=94=82 Class Name >>>>>>>>>>>> = =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 >>>>>>>>>>>> osgi:service/responder =E2=94=82 = org.mariadb.jdbc.MySQLDataSource >>>>>>>>>>>> osgi:service/jndi =E2=94=82 = org.apache.karaf.jndi.internal.JndiServiceImpl >>>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>> Best regards, >>>>>>>>>>>> Alex soto >>>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>>> On May 16, 2018, at 3:48 PM, Tim Ward = > wrote: >>>>>>>>>>>>>=20 >>>>>>>>>>>>> Just looking quickly.=20 >>>>>>>>>>>>>=20 >>>>>>>>>>>>> You have the same JNDI name for both JTA and non JTA = DataSources. This is clearly wrong as the DataSource cannot = simultaneously be enlisted in the Transaction and not enlisted. The = comments also indicate a misunderstanding of the purpose of the = non-jta-datasource, which absolutely is used with JTA EntityManagers = (for things like sequence allocation and out of band optimisations). You = really do need to have both and they do need to behave differently. >>>>>>>>>>>>>=20 >>>>>>>>>>>>> At a guess your DataSource is not enlisted with the = transaction manager present in the system. This usually happens by = configuring a (otherwise invisible) DataSource wrapper There is nothing = forcing you to make this happen (or checking that it does) hence your = transactions would be broken. This is one of the several reasons I try = to direct people to Transaction Control where the model actively pushes = you toward transactions that actually work, rather than hiding all the = magic behind an annotation. >>>>>>>>>>>>>=20 >>>>>>>>>>>>> Hopefully this gives you some clues as to what might be = wrong.=20 >>>>>>>>>>>>>=20 >>>>>>>>>>>>> Best Regards, >>>>>>>>>>>>>=20 >>>>>>>>>>>>> Tim >>>>>>>>>>>>>=20 >>>>>>>>>>>>> Sent from my iPhone >>>>>>>>>>>>>=20 >>>>>>>>>>>>>> On 16 May 2018, at 21:34, Jean-Baptiste Onofr=C3=A9 = > wrote: >>>>>>>>>>>>>>=20 >>>>>>>>>>>>>> Are you sure about your code ? Flush looks weird to me = and it seems you don't use container managed transaction. >>>>>>>>>>>>>>=20 >>>>>>>>>>>>>> Regards >>>>>>>>>>>>>> JB >>>>>>>>>>>>>>=20 >>>>>>>>>>>>>>> On 16/05/2018 21:08, Alex Soto wrote: >>>>>>>>>>>>>>> Yes, same result. I even tried with Narayana = Transaction Manager, and same result. >>>>>>>>>>>>>>> Best regards, >>>>>>>>>>>>>>> Alex soto >>>>>>>>>>>>>>>> On May 16, 2018, at 2:56 PM, Jean-Baptiste Onofr=C3=A9 = >> wrote: >>>>>>>>>>>>>>>>=20 >>>>>>>>>>>>>>>> Same behavior with RequiresNew ? >>>>>>>>>>>>>>>>=20 >>>>>>>>>>>>>>>> Regards >>>>>>>>>>>>>>>> JB >>>>>>>>>>>>>>>>=20 >>>>>>>>>>>>>>>>> On 16/05/2018 19:44, Alex Soto wrote: >>>>>>>>>>>>>>>>> With Karaf version 4.2.0, Rollback is not working with = MariaDB and InnoDB tables. >>>>>>>>>>>>>>>>> I deployed these features (from Karaf=E2=80=99s = enterprise repository): >>>>>>>>>>>>>>>>> aries-blueprint >>>>>>>>>>>>>>>>> transaction >>>>>>>>>>>>>>>>> jndi >>>>>>>>>>>>>>>>> jdbc >>>>>>>>>>>>>>>>> jpa >>>>>>>>>>>>>>>>> pax-jdbc-mariadb >>>>>>>>>>>>>>>>> pax-jdbc-config >>>>>>>>>>>>>>>>> pax-jdbc-pool-dbcp2 >>>>>>>>>>>>>>>>> hibernate >>>>>>>>>>>>>>>>> My Data Source is configured in the file = /org.ops4j.datasource-responder.cfg/ >>>>>>>>>>>>>>>>> osgi.jdbc.driver.name =3D mariadb >>>>>>>>>>>>>>>>> dataSourceName=3Dresponder >>>>>>>>>>>>>>>>> url >>>>>>>>>>>>>>>>> =3D = jdbc:mariadb://mariadb.local:3306/responder?characterEncoding=3DUTF-8&useS= erverPrepStmts=3Dtrue&autocommit=3Dfalse = >>>>>>>>>>>>>>>>> user=3DXXXX >>>>>>>>>>>>>>>>> password=3DXXXX >>>>>>>>>>>>>>>>> databaseName=3Dresponder >>>>>>>>>>>>>>>>> #Pool Config >>>>>>>>>>>>>>>>> pool=3Ddbcp2 >>>>>>>>>>>>>>>>> xa=3Dtrue >>>>>>>>>>>>>>>>> My persistence.xml: >>>>>>>>>>>>>>>>> " >>>>>>>>>>>>>>>>> = xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance = " >>>>>>>>>>>>>>>>> = xsi:schemaLocation=3D"http://java.sun.com/xml/ns/persistence = >>>>>>>>>>>>>>>>> = http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd = "> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> = org.hibernate.jpa.HibernatePersistenceProvider >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> = osgi:service/javax.sql.DataSource/(osgi.jndi.service.name= =3Dresponder) >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> = osgi:service/javax.sql.DataSource/(osgi.jndi.service.= name=3Dresponder) >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> My blueprint.xml: >>>>>>>>>>>>>>>>> " >>>>>>>>>>>>>>>>> xmlns:jpa=3D"http://aries.apache.org/xmlns/jpa/v2.0.0 = " >>>>>>>>>>>>>>>>> = xmlns:tx=3D"http://aries.apache.org/xmlns/transactions/v2.0.0 = " >>>>>>>>>>>>>>>>> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance= " >>>>>>>>>>>>>>>>> = xsi:schemaLocation=3D"http://www.osgi.org/xmlns/blueprint/v1.0.0 = >>>>>>>>>>>>>>>>> https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd = "> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> For testing I throw exception in my DAO: >>>>>>>>>>>>>>>>> @Transactional(REQUIRED) >>>>>>>>>>>>>>>>> public void addUser(User user) { >>>>>>>>>>>>>>>>> em.persist(user); >>>>>>>>>>>>>>>>> em.flush(); >>>>>>>>>>>>>>>>> throw new RuntimeException("On Purpose"); >>>>>>>>>>>>>>>>> } >>>>>>>>>>>>>>>>> I expect the record not to be in the table due to = rollback of the transaction, but it still shows up in my database table. >>>>>>>>>>>>>>>>> Best regards, >>>>>>>>>>>>>>>>> Alex soto --Apple-Mail=_CDC83295-3A1D-462C-BC9E-130F40ACF526 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Great, I solved the Eclipse problem.  Thanks.

Yes, Karaf provides DS = 1.3,  but no DS 1.4 out off the box.
Maybe = this is available from Aries?

Best regards,
Alex soto




On May 18, 2018, at 11:18 AM, Tim Ward <tim.ward@paremus.com> wrote:

Hi,

Answers inline:

Sent = from my iPhone

On 18 May 2018, at = 16:55, Alex Soto <alex.soto@envieta.com> wrote:

Thank you Tim for the very detailed explanation.
There are  two problems I don=E2=80=99t know how to = resolve:

1- = BND generates this for my bundle: 

Require-Capability: =  osgi.extender;filter:=3D"(&(osgi.extender=3Dosgi.component)(vers= ion>=3D1.3.0)(!(version>=3D2.0.0)))=E2=80=9D

This is = because I use the @Component and @Reference annotations.  This is = strange, since I should be using OSGi R7, so I am not sure why it is = saying 1.3.0.  Now when try to run in Karaf, even though I am = installing scr feature, it fails with = unresolved requirement.

So in the absence of information to the = contrary this requirement is added based on your usage of Declarative = Services features. If you use DS 1.3 features then DS 1.3 will be = required. 

Since R7 added the bundle requirement annotations the = @Component annotation has been annotated to require DS at the current = spec version (this gives a more consistent behaviour than bnd=E2=80=99s = heuristics). At a guess you are picking up a 1.3 requirement because you = have the 1.3 annotations ahead of the 1.4 annotations on your classpath, = but it could be triggered by other things too. On the other hand this = isn=E2=80=99t actually a problem as the requirement is still satisfied = by DS 1.4 and both versions will work for you at runtime.

The Karaf scr feature = really should be providing SCR 1.3 (which is required by the spec to = provide the extender capability. That has been the current version of = the spec for three years, and has been provided by Felix for at least 6 = releases. I=E2=80=99d be pretty shocked if DS 1.3 wasn=E2=80=99t = supported. You may need help from a more Karaf focussed person to = confirm this. 


= Since I could not find OSGi R7 in public Maven Repos, I = followed EnRoute depending on:
      <dependency>
      =   <groupId>org.osgi.enroute</groupId>
      =   <artifactId>osgi-api</artifactId>
      =   <version>7.0.0-SNAPSHOT</version>
      =   <type>pom</type>
    =     <scope>provided</scope>
      </dependency>
      <dependency>
      =   <groupId>org.osgi.enroute</groupId>
      =   <artifactId>enterprise-api</artifactId>
      =   <version>7.0.0-SNAPSHOT</version>
      =   <type>pom</type>
    =     <scope>provided</scope>
    =   </dependency>

There=E2=80=99s no = problem with you using these. On the other hand the OSGi API = aggregations you are looking for are: 

=

=

You can also find = the individual specs under the org.osgi group id if you want to use a = smaller hammer :)


2- This is minor, and I see it also in the EnRoute project. = While the Maven build succeeds, Eclipse BND plugin shows 2 = errors:

The default package '.' = is not permitted by the Import-Package syntax. This can be caused = by compile errors in Eclipse because Eclipse creates valid = class files regardless of compile errors. The following package(s) = import from the default = package [org.enquery.encryptedquery.responder.data.service.impl] = (biz.aQute.bnd:bnd-maven-plugin:4.0.0:bnd-process:default:process-classes)= = pom.xml /encryptedquery-responder-data line = 0 = Maven Build Participant = Problem 

The project was not built since its build path is incomplete. = Cannot find the class file for javax.persistence.EntityManager. Fix the = build path then try building this project = encryptedquery-responder-data Unknown Java = Problem

 

As the message suggests, this usually = occurs when Eclipse has build errors for the project. Specifically in = this case you seem to be building against a project which exposes the = EntityManager interface somehow, but you don=E2=80=99t have the JPA API = in your compile dependencies (normally these would come come in = transitively from the project you depend on). 

I hope this = helps,

Tim



Best = regards,
Alex soto




On May = 18, 2018, at 5:23 AM, Tim Ward <tim.ward@paremus.com> wrote:

Hi Alex,

The bundles you need are listed in the bndrun for the JPA = version of the enRoute application, but as I think you=E2=80=99re using = OpenJPA (rather than Hibernate) it may help to explain things in = relation to the Transaction Control JPA integration test for OpenJPA. = I=E2=80=99m sure that at least some of this will be stuff you already = know, but I=E2=80=99m trying to make sure I give a compete = explanation. 

This method defines some extra properties to add to the = persistence unit. It references a couple of open bugs in OpenJPA which = may or may not affect you. It also adds schema generation as OpenJPA = does not support the standard properties from JPA 2.1 https://github.com/apache/aries-tx-control/blob/master/tx-contr= ol-providers/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/c= ontrol/itests/SimpleOpenJPA_2_4_1_Test.java#L34

This method defines the OpenJPA bundles and their immediate = dependencies. https://github.com/apache/aries-tx-control/blob/master/tx-contr= ol-providers/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/c= ontrol/itests/SimpleOpenJPA_2_4_1_Test.java#L48

You then need:

=E2=80=A2 Aries JPA = 2.7.0 - this provides the OSGi JPA Service 1.1 RI (1.1 features are = needed by the Aries Tx Control JPA resource provider to support = XA)


=E2=80=A2 Aries Tx = Control JPA resource provider - either XA or local depending on your = needs. Note that you can=E2=80=99t use the XA provider with the local = service, but you can use the local provider with the XA service = (although this doesn=E2=80=99t make a lot of sense to do). For = example https://github.com/apache/aries-tx-control/blob/master/tx-contr= ol-providers/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/c= ontrol/itests/AbstractJPATransactionTest.java#L377

=E2=80=A2 A JDBC Service = implementation supporting your database driver. H2 supports this = natively (which is why it is used in many examples) but MariaDB does = not. Therefore you will need to deploy PAX-JDBC=E2=80=99s support. = See https://github.com/ops4j/org.ops4j.pax.jdbc/tree/master/pax-jdb= c-mariadb

You then have the option of either programmatically = assembling your Resource Provider, or using configuration. Configuration = is generally easier and is what I normally recommend. At that point you = need to create a factory configuration for the relevant PID (it depends = on whether you use the local or XA resource provider, see https://github.com/apache/aries-tx-control/blob/master/tx-contr= ol-providers/jpa/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/c= ontrol/itests/AbstractJPATransactionTest.java#L175)

The necessary configuration properties = are:

=E2=80=A2 = url - the JDBC URL for your database 
=E2=80=A2 = osgi.jdbc.driver.class - the database driver class name, in your = case org.mariadb.jdbc.Driver
=E2=80=A2 = osgi.unit.name - the name of your persistence = unit 

The result of this = configuration will be a JPAEntityManagerProvider service registered in = the service registry (using your EntityManagerFactoryBuilder and the = MariaDB DataSourceFactory). You can then Inject that service into your = code and combine it with the TransactionControl service to make a thread = safe EntityManager that you can use in all your requests (just like the = enRoute example does). 

I hope this = helps,

Tim

Sent from my = iPhone

On 17 May 2018, at 22:46, = Alex Soto <alex.soto@envieta.com> wrote:

Thanks Tim, 

I was using branch R7, changed to master, it builds = now.

Now I = have updated my project to OSGi 7 with Transaction Control, how do I = deploy to Karaf?
i.e., what bundles/features do I = need?


Best regards,
Alex soto




On May 17, 2018, at 2:08 PM, Tim Ward <tim.ward@paremus.com> wrote:

Hi Alex,

Bnd 4.0.0 was only released last Sunday, but this should have = been changed yesterday in this commit https://github.com/osgi/osgi.enroute/commit/9f9857c3d317cd08a7a= af7327c1904676299f9ee to make sure enRoute kept = building. 

EnRoute is automatically pushed to the sonatype OSGi nexus = repository, so is it possible that you=E2=80=99re running offline, or = firewalled from the repo? You should be able to force snapshot updates = from the Maven command line. 

Best Regards,

Tim

Sent from my iPhone

On 17 = May 2018, at 18:26, Alex Soto <alex.soto@envieta.com> wrote:

Allright,  I am trying to follow = the EnRoute tutorial.

I am getting this error:

[ERROR] Plugin = biz.aQute.bnd:bnd-maven-plugin:4.0.0-SNAPSHOT or one of its dependencies = could not be resolved: Could not find artifact = biz.aQute.bnd:bnd-maven-plugin:jar:4.0.0-SNAPSHOT in Bnd = Snapshots (https://bndtools.ci.cloudbees.com/job/bnd.master/lastSuccessful= Build/artifact/dist/bundles/) -> [Help 1]


Any = idea (time frame) when this will move from SNAPSHOT = dependencies?


Best = regards,
Alex soto




On May = 17, 2018, at 11:08 AM, Tim Ward <tim.ward@paremus.com> wrote:

It is highly unlikely that you=E2=80=99ll hit the same = issues. The transaction control resource provider uses the = DataSourceFactory directly to create a DataSource (either progamatically = using a factory service or via config admin) that enlists itself in the = ongoing transaction. This means that the answer to your question is = =E2=80=9Cwith Transaction Control you don=E2=80=99t have to do that = because it does it automatically=E2=80=9D

If you want to use XA transactions then = the only requirement is that the DataSourceFactory can produce an = XADataSource, otherwise it just uses the standard JDBC API to = commit/rollback. If your DataSourceFactory doesn=E2=80=99t support XA = then use the local resource provider implementation.

Best Regards,

Tim

Sent from my iPhone

On 17 May 2018, at 15:17, Alex Soto <alex.soto@envieta.com> wrote:

I = will take a look at these examples.

However, I think that if I cannot get a = MariaDB DataSource that supports transactions, then it will still not = work, right?
If the examples use H2 database, I = still may get different results when I change to MariaDB, and I will = find myself in the same spot as of now.

So, the question remains about what is = the correct way how to register a transaction aware MariaDB = DataSource.


Best regards,
Alex soto




On May 17, 2018, at 1:46 AM, Tim Ward <tim.ward@paremus.com> wrote:

The best place to start when looking for OSGi R7 examples is = the enRoute Project. It contains Maven Archetypes, examples and worked = tutorials for building applications using R7 specifications. 


Most of the projects in use are just = new versions of long established OSGi implementations from Aries and = Felix. The majority of them are already released and in Maven Central. = Those that are still in the process of releasing (pretty much just the = JAX-RS whiteboard) are available in the Apache Snapshots repository. I = am not aware of any implementations that require R7 framework features, = so all of them should run on Karaf.

Best Regards,

Tim

Sent from my iPhone

On 16 = May 2018, at 22:25, Alex Soto <alex.soto@envieta.com> wrote:

I = agree, it s very frustrating and time consuming. Almost impossible to = get it right.
I may try the OSGi R7, but I am not sure of = its adoption level at this time, availability of bundles, examples, = support by Karaf, etc.


Anyway, back to my = current stack.  I only see one DataSource being = registered:

karaf@root()> service:list DataSource
[javax.sql.DataSource]
----------------------
 databaseName =3D responder
 dataSourceName =3D responder
 osgi.jdbc.driver.name =3D mariadb
 osgi.jndi.service.name =3D responder
 service.bundleid =3D 14
 service.factoryPid =3D org.ops4j.datasource
 service.id =3D 194
 service.pid =3D = org.ops4j.datasource.feb33f6d-dc46-4bc7-a417-ad6bdd5a6ee5
 service.scope =3D singleton
 url =3D = jdbc:mariadb:XXXXXX
Provided by : 
 OPS4J Pax JDBC Config (14)
Used = by: 
 Data (135)


Not sure what to do with this.  
I = specified the following in the configuration:

pool=3Dnarayana
xa=3Dtrue

Best regards,
Alex soto




On May 16, 2018, at 4:12 PM, Tim Ward <tim.ward@paremus.com> wrote:

The structure of the JNDI name is defined by the JNDI service = specification. 

osgi:service/<interface = name>[/<filter>]

So in this case both of your services should be DataSource = instances, but they should have different filters. 

The important thing is = to make sure you have an JTA enlisting DataSource registered as a = service (this isn=E2=80=99t just your normal DataSource), then to build = a filter which selects that. One option for this is to use the = enlistment whiteboard from Aries (not well documented) https://github.com/apache/aries/tree/trunk/transaction/transact= ion-jdbc

This is a non-trivial thing to do, which is why I keep = mentioning Transaction Control which handles the enlistment reliably = without the layers of services. 

Best Regards,

Tim

Sent from my iPhone

On 16 May 2018, at 21:57, Alex Soto <alex.soto@envieta.com> wrote:

Thank you Tim.

Any idea what the JNDI names would be?
It is = Pax-JDBC creating these JNDI names, so I have no idea.

=46rom the Karaf = console:


karaf@root()> jndi:names 
JNDI = Name              =E2=94=82 = Class Name
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80
osgi:service/responder =E2=94=82 = org.mariadb.jdbc.MySQLDataSource
osgi:service/jndi  =     =E2=94=82 = org.apache.karaf.jndi.internal.JndiServiceImpl


Best regards,
Alex soto




On May 16, 2018, at 3:48 PM, Tim Ward <tim.ward@paremus.com> wrote:

Just = looking quickly. 

You have the same JNDI name for both JTA and = non JTA DataSources. This is clearly wrong as the DataSource cannot = simultaneously be enlisted in the Transaction and not enlisted. The = comments also indicate a misunderstanding of the purpose of the = non-jta-datasource, which absolutely is used with JTA EntityManagers = (for things like sequence allocation and out of band optimisations). You = really do need to have both and they do need to behave differently.

At a guess your DataSource is not enlisted = with the transaction manager present in the system.  This usually = happens by configuring a (otherwise invisible) DataSource wrapper There = is nothing forcing you to make this happen (or checking that it does) = hence your transactions would be broken. This is one of the several = reasons I try to direct people to Transaction Control where the model = actively pushes you toward transactions that actually work, rather than = hiding all the magic behind an annotation.

Hopefully this gives you some clues as to what might be = wrong. 

Best Regards,

Tim

Sent from my iPhone

On 16 May = 2018, at 21:34, Jean-Baptiste Onofr=C3=A9 <jb@nanthrax.net> = wrote:

Are you sure about your code ? Flush = looks weird to me and it seems you don't use container managed = transaction.

Regards
JB

On = 16/05/2018 21:08, Alex Soto wrote:
Yes, same result. =  I even tried with Narayana Transaction Manager, and same = result.
Best regards,
Alex soto
On May 16, 2018, at 2:56 = PM, Jean-Baptiste Onofr=C3=A9 <jb@nanthrax.net <mailto:jb@nanthrax.net>> wrote:

Same behavior with RequiresNew ?

Regards
JB

On 16/05/2018 19:44, = Alex Soto wrote:
With Karaf version 4.2.0, Rollback is not = working with MariaDB and InnoDB tables.
I deployed these = features (from Karaf=E2=80=99s enterprise  repository):
<feature>aries-blueprint</feature>
<feature>transaction</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>jpa</feature>
<feature>pax-jdbc-mariadb</feature>
       <feature>pax-jd= bc-config</feature>
<feature>pax-jdbc-pool-dbcp2</feature>
<feature>hibernate</feature>
My = Data Source is configured in the file = /org.ops4j.datasource-responder.cfg/
  osgi.jdbc.driver.name =3D mariadb
  dataSourceName=3Dresponder
  url
  =3D jdbc:mariadb://mariadb.local:3306/responder?characterEncoding=3DUTF-= 8&useServerPrepStmts=3Dtrue&autocommit=3Dfalse
  user=3DXXXX
  password=3DXXXX
  databaseName=3Dresponder
  #Pool Config
  pool=3Ddbcp2
  xa=3DtrueMy persistence.xml:
  <persistence = version=3D"2.0" xmlns=3D"http://java.sun.com/xml/ns/persistence"
       xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation=3D= "http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"= >
          &nb= sp;<persistence-unit name=3D"responderPersistenUnit" = transaction-type=3D"JTA">
          &nb= sp;    <provider>org.hibernate.jpa.HibernatePers= istenceProvider</provider>
          &nb= sp;<!-- Only used when transaction-type=3DJTA -->
          &nb= sp;    <jta-data-source>osgi:service/javax.sql.D= ataSource/(osgi.jndi.service.name=3Dresponder)</jta-data-source>
          &nb= sp;<!-- Only used when transaction-type=3DRESOURCE_LOCAL -->
          &nb= sp;    <non-jta-data-source>osgi:service/javax.s= ql.DataSource/(osgi.jndi.service.name=3Dresponder)</non-jta-data-source= >
          &nb= sp;<properties>
          &nb= sp;        <property = name=3D=E2=80=9Chibernate.dialect" = value=3D"org.hibernate.dialect.MySQL5Dialect" />
          &nb= sp;    <property name=3D"hibernate.show_sql" = value=3D"true" />
          &nb= sp;    <property name=3D"hibernate.format_sql" = value=3D"true" />
          &nb= sp;    <property name=3D"hibernate.hbm2ddl.auto" = value=3D"none"/>
          &nb= sp;</properties>
       </persistence-unit= >
  </persistence>
My = blueprint.xml:
  <blueprint xmlns=3D"http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:jpa=3D"http://aries.apache.org/xmlns/jpa/v2.0.0"
  xmlns:tx=3D"http://aries.apache.org/xmlns/transactions/v2.0.0"
  xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation=3D"http://www.osgi.org/xmlns/blueprint/v1.0.0
https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"><= br class=3D"">  <jpa:enable />
  <tx:enable />
  <bean id=3D"userService" = class=3D"org.data.impl.UserServiceImpl" />
  <service ref=3D"userService" = interface=3D"org.data.UserService" />
  </blueprint>
For testing I = throw exception in my DAO:
@Transactional(REQUIRED)
public void addUser(User user) {
em.persist(user);
em.flush();
throw= new RuntimeException("On Purpose");
}
I = expect the record not to be in the table due to rollback of the = transaction, but it still shows up in my database table.
Best regards,
Alex = soto

= --Apple-Mail=_CDC83295-3A1D-462C-BC9E-130F40ACF526--