I recently had a similar problem when trying transactions on bndtools.

The bndtools guys proposed a different solution by adding the jta 1.1 spec to the runpath.

See
https://github.com/cschneider/bndtools-tutorials/blob/master/tasklist-ds/tasklist.bndrun#L14

The nice thing with the above solution is that you do not have to exclude the javax.transaction.xa package from the system bundle exports. In karaf this is less of an issue as karaf completely redefines the system package exports anyway.

Interestingly I was able to get jpa as well as CXF running on bndtools without redefining the system package exports. So without overriding the spec apis and impls from java.

So I wonder what are the advantages / disadvantages of the two approaches.

Christian


On 22.11.2016 20:29, Guillaume Nodet wrote:
Yes, the long answer is the following:
   * the javax.transaction.xa package provided by the JRE is incomplete
   * it contains a few classes used by the jdbc package
   * if the system bundle exports this package, users will hit
NoClassDefFoundError because of the missing class
   * if the classes from the JRE are not used, there will be
ClassCastException when using JDBC because the jdbc package uses the
classes from the JRE while the driver deployed as an OSGi bundle will use
the classes deployed as a bundle
The only solution is the one used in karaf since years:
   - the system bundle exports javax.transaction; javax.transaction.xa;
partial=true; mandatory:=partial
      This means that the package is exported but not really usable
   - the system bundle boot delegate javax.transaction and
javax.transaction.xa
   - users should deploy a bundle such as
mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1 to provide the
full packages


2016-11-22 19:49 GMT+01:00 Achim Nierbeck <[email protected]>:

There is a Pax-JDBC Postgres feature, which also includes the Aries TX
because of that. [1]

regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/
pax-jdbc-features/src/main/resources/features.xml#L83-L90

2016-11-22 19:45 GMT+01:00 Guillaume Nodet <[email protected]>:

The package provided by the JRE is incomplete so you need to deploy the
XA
api separately.

2016-11-22 19:42 GMT+01:00 Fabian Lange <[email protected]>:

Hi,
i just tried to use the new postgres driver for java 8:

Error executing command: Error executing command on bundles:
Error starting bundle 101: Unable to resolve org.postgresql.jdbc42
[101](R
101.0): missing requirement [org.postgresql.jdbc42 [101](R 101.0)]
osgi.wiring.package; (osgi.wiring.package=javax.transaction.xa)
Unresolved
requirements: [[org.postgresql.jdbc42 [101](R 101.0)]
osgi.wiring.package;
(osgi.wiring.package=javax.transaction.xa)]

I see the .xa package is not exported in bootdelegation. I searched for
this and could not find any reason it is not. is it just missing or is
there a deeper reason?
Fabian

--
Fabian Lange | Performance Expert
mobil: +49 (0) 160.3673393

codecentric AG | Merscheider Straße 1 | 42699 Solingen | Deutschland

Sitz der Gesellschaft: Solingen | HRB 25917| Amtsgericht Wuppertal
Vorstand: Michael Hochgürtel . Mirko Novakovic . Rainer Vehns
Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Klaus Jäger . Jürgen
Schütz


--
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: [email protected]
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/



--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master





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

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

Reply via email to