Avoid the -d option on exports and it should show you both.

It's what I suspected: multiple bundles providing the package.

How can I help you there ? Please let me know I have some time tonight ;)

Regards
JB

On 11/08/2015 07:29 PM, Benson Margulies wrote:
I think I see the direction; I didn't know that bundle:find-class
requires slashes, not dots.

So, how do I sort out Pax Web versus the glassfish bundle where I
expected it to turn up? And why does package:exports -d not reveal the
combination of 174 and 187?



karaf@root>bundle:find-class ExpressionFactoryImpl

Expression Language 2.2 Implementation (174)
com/sun/el/ExpressionFactoryImpl.class

OPS4J Pax Web - Jetty (185)
org/apache/el/ExpressionFactoryImpl.class

OPS4J Pax Web - Jsp Support (186)
org/apache/el/ExpressionFactoryImpl.class

OPS4J Pax Web - Runtime (187)
com/sun/el/ExpressionFactoryImpl.class

On Sun, Nov 8, 2015 at 1:24 PM, Benson Margulies <[email protected]> wrote:
I tried bundle:tree-show on the hibernate bundle
(https://gist.github.com/benson-basis/d76e7c79e3a277a27efa). Maybe the
fact that it isn't showing me anything I recognize about javax.el is
the root of the trouble?


On Sun, Nov 8, 2015 at 1:21 PM, Benson Margulies <[email protected]> wrote:
Felix is the framework.

I do not have any PackageAdmin code.

I don't have a great way to make this available to you right now. I am
considering trying to switch to the cxf bean validation feature
instead of the code I posted.

I think the following is the most relevant backtrace:

Caused by: java.lang.ClassNotFoundException:
com.sun.el.ExpressionFactoryImpl not found by
org.apache.cxf.cxf-rt-transports-http [102]
at 
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1558)
at 
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at 
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1998)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1919)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:959)
at 
org.ops4j.pax.swissbox.core.BundleClassLoader.findClass(BundleClassLoader.java:176)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at 
org.ops4j.pax.swissbox.core.BundleClassLoader.loadClass(BundleClassLoader.java:192)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at javax.el.FactoryFinder.newInstance(FactoryFinder.java:87)
at javax.el.FactoryFinder.find(FactoryFinder.java:197)
at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:189)
at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:160)
at 
org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm.&lt;clinit&gt;(InterpolationTerm.java:60)




On Sun, Nov 8, 2015 at 1:11 PM, Benson Margulies <[email protected]> wrote:
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

--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to