Improve OSGi integration addressing class loading issues

Description

Please see https://issues.apache.org/jira/browse/CXF-6706.

I, and others, have encountered some problems.

SPI and class loading

As with some other JSRs, javax.validation suffers from classloader problems when used in OSGi. At very least, one must manipulate the thread context classloader. I have never succeeded in making the SPI work; all the examples I have seem end up using a customized provider that references HibernateValidator. If there is a way to get this to work, many would benefit from documentation of it.

However, the problem gets worse. Hibernate goes and calls the API for javax.el _at the time the application calls validate. So, the application has to come up with a classloader that 'sees' com.sun.el (or whatever) when it calls validate, not just when it builds a validator. This is really a pain.

Karaf feature

The Karaf feature provided uses the <wrap> mechanism. This is not desirable, and, in fact, causes Karaf 4 to hang in some cases. It's not needed; see https://github.com/apache/cxf/blob/3.1.x-fixes/osgi/karaf/features/src/main/resources/features.xml#L443 for a working feature that does not use wrap.

However, also note that this depends on the ServiceMix bundle that provides a solution to the SPI classloading problem

Environment

Apache Karaf 4.0,2, etc.

Status

Assignee

Unassigned

Reporter

BensonB

Labels

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Fix versions

Affects versions

5.2.2.Final

Priority

Major
Configure