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