Hi,

To deploy JBI SA/SU in OSGi container, you shouldn't embed any bundle jars, you 
should just refer them in your xbean.xml, the pattern is like
<classpath>
  <library>osgi:Bundle-SymbolicName</library>
</classpath>
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-13, at 上午12:04, djtom wrote:

> Hi,
> 
> I created an OSGi bundle which uses ehcache-core library. In turn, ehcache
> library uses slf4j logging, therefore I already included the slf4j jars in
> the dependencies of the OSGi bundle. My bundle works well as a separate OSGi
> bundle in servicemix. However, if I use the OSGi bundle from a SE (I created
> a JBI Component), the following exception occurs (I checked SE zip file, it
> has my OSGi bundle as a jar, and the OSGi bundle has slf4j-api and
> slf4j-jdk14 jars. Moreover, service engine always asks for 1.5.8 version of
> slf4j jar even if I use 1.6.0):
> 
> java.lang.NoClassDefFoundError: org/apache/log4j/Level
>       at
> org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:223)[slf4j-api-1.5.8.jar:1.5.8]
>       at
> org.slf4j.LoggerFactory.bind(LoggerFactory.java:120)[slf4j-api-1.5.8.jar:1.5.8]
>       at
> org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)[slf4j-api-1.5.8.jar:1.5.8]
>       at
> org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)[slf4j-api-1.5.8.jar:1.5.8]
>       at
> org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)[slf4j-api-1.5.8.jar:1.5.8]
>       at
> org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255)[slf4j-api-1.5.8.jar:1.5.8]
>       at
> net.sf.ehcache.CacheManager.<clinit>(CacheManager.java:131)[ehcache-core-2.6.0.jar:]
>       at
> de.unistuttgart.iaas.jbimulti2.cache.CacheFactory.getCache(CacheFactory.java:16)[jbi.servicemix.registry-1.0.jar:]
>       at
> de.unistuttgart.iaas.jbimulti2.registry.ServiceRegistry.<init>(ServiceRegistry.java:35)[jbi.servicemix.registry-1.0.jar:]
>       at
> de.unistuttgart.iaas.jbimulti2.jbi.servicemix.dsds.DSDSEndpoint.processInOut(DSDSEndpoint.java:72)[servicemix-dsds-2011.01.jar:2011.01]
>       at
> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(ProviderEndpoint.java:111)[servicemix-common-2011.01.jar:2011.01]
>       at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:651)[servicemix-common-2011.01.jar:2011.01]
>       at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:606)[servicemix-common-2011.01.jar:2011.01]
>       at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:501)[servicemix-common-2011.01.jar:2011.01]
>       at
> org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:370)[servicemix-common-2011.01.jar:2011.01]
>       at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.6.0_20]
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.6.0_20]
>       at java.lang.Thread.run(Thread.java:636)[:1.6.0_20]
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level in
> classloader servicemix-shared
>       at
> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)[125:org.apache.servicemix.jbi.deployer:1.4.0]
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:266)[:1.6.0_20]
> 
> 
> 
> 
> --
> View this message in context: 
> http://servicemix.396122.n5.nabble.com/slf4j-library-of-OSGi-bundle-cannot-found-in-a-SE-JBI-Component-tp5714899.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Reply via email to