Uploaded image for project: 'Hibernate Validator'
  1. HV-1039

Improve OSGi integration addressing class loading issues


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.2.Final
    • Fix Version/s: 5.3.0.Alpha1
    • Component/s: None
    • Labels:
    • Environment:
      Apache Karaf 4.0,2, etc.
    • Last commented by a user?:
    • Sprint:


      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


          Issue links



              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: