Karaf 4.0.2 hangs on this; I suspect it's the use of wrap.
On Sun, Nov 8, 2015 at 3:37 PM, Benson Margulies <[email protected]> wrote: > That looks promising. Ever tried it with Karaf 4? I'm about to fire it up. > > On Sun, Nov 8, 2015 at 3:31 PM, Christian Schneider > <[email protected]> wrote: >> The problem you observe can happen if the classloader that is used does not >> see the necessary packages. >> As in OSGi each bundle classloader can only see the packages it imports you >> can have the effect that you can not load a package even if it is in the >> bundle if the code uses a classloader that does not have the necessary >> imports (e.g. from a different bundle). >> This typically happens with legacy code that makes assumptions on the >> classloader that it rather should not for OSGi. >> >> The hibernate vailidation is such a case. The good news is that it can be >> tuned to work in OSGi. >> >> See >> https://github.com/hibernate/hibernate-validator/blob/master/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest.java >> >> Christian >> >> >> Am 08.11.2015 um 19:11 schrieb Benson Margulies: >>> >>> package:exports -d does not think that more than one bundle is >>> exporting the package. >>> >>> Here's the class I built to stay out of the SPI. >>> >>> public final class OSGIValidationFactory { >>> private OSGIValidationFactory() { >>> // >>> } >>> >>> static class OSGIServiceDiscoverer implements >>> ValidationProviderResolver { >>> >>> @Override >>> public List<ValidationProvider<?>> getValidationProviders() { >>> List<ValidationProvider<?>> providers = new ArrayList<>(); >>> providers.add(new HibernateValidator()); >>> return providers; >>> } >>> } >>> >>> public static ValidatorFactory newHibernateValidatorFactory() { >>> javax.validation.Configuration<?> config = >>> Validation.byDefaultProvider() >>> .providerResolver(new OSGIServiceDiscoverer()) >>> .configure(); >>> >>> return config.buildValidatorFactory(); >>> } >>> } >>> >>> >>> On Sun, Nov 8, 2015 at 1:10 PM, Benson Margulies <[email protected]> >>> wrote: >>>> >>>> Karaf 4.0.2. >>>> >>>> I'm not sure what you mean by 'framework'. I'm just running karaf, I >>>> am not messing with the system bundle. I pulled together my own little >>>> bundle for validation that uses a custom locator to avoid the SPI, and >>>> it works in an isolated test in karaf, but when I put the whole thing >>>> together, blam. How would I investigate the possibility of multiple >>>> bundles? >>>> >>>> >>>> >>>> On Sun, Nov 8, 2015 at 1:06 PM, Jean-Baptiste Onofré <[email protected]> >>>> wrote: >>>>> >>>>> Hi Benson, >>>>> >>>>> don't you have multiple bundle providing the same package ? >>>>> I suspect two bundles providing com.sun.el package (or the system >>>>> package). >>>>> >>>>> What's the Karaf version (and framework in use) ? >>>>> >>>>> Regards >>>>> JB >>>>> >>>>> >>>>> On 11/08/2015 07:04 PM, Benson Margulies wrote: >>>>>> >>>>>> I'm getting a ClassNotFoundException trying to use bean validation. >>>>>> >>>>>> karaf@root>package:exports | grep com.sun.el >>>>>> com.sun.el | 2.2.4 >>>>>> | 174 | org.glassfish.web.javax.el >>>>>> >>>>>> But: >>>>>> >>>>>> karaf@root> bundle:find-class com.sun.el.ExpressionFactoryImpl >>>>>> karaf@root> >>>>>> >>>>>> even though the class is sitting right there in the jar file for that >>>>>> bundle. >>>>>> >>>>>> karaf@root>bundle:classes 174 | grep Expr >>>>>> com/sun/el/ExpressionFactoryImpl.class >>>>>> >>>>>> what's up? >>>>>> >>>>> -- >>>>> Jean-Baptiste Onofré >>>>> [email protected] >>>>> http://blog.nanthrax.net >>>>> Talend - http://www.talend.com >> >>
