You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by shooding <sh...@gmail.com> on 2011/07/20 10:44:36 UTC

Diff in classloading of lwcontainer and the container of smx 4.3?

I kept run into ClassNotFoundException of org.apache.log4j,

When developing BC and running the test through spring.xml (like
servicemix.xml),
it's a BUILD SUCCESS. But after setup SU, zipped in SA, deployed, still got
ClassNotFoundException.

Test 1: put log4j.jar into the [smx]/lib/ and restart servicemix doesn't
help.
Test 2: try to manually load class("org.apache.log4j") first in my Binding
Component. The same exception showed.

I wonder if the classloading mechanism is different between lwcontainer and
the container of smx?

-----
Industrial Technology Research Institute
Rm. 226 Bldg. 14, 2F, 195, Sec. 4, Chung Hsing Rd.,
Chutung, Hsinchu, Taiwan 31040, R.O.C.
--
View this message in context: http://servicemix.396122.n5.nabble.com/Diff-in-classloading-of-lwcontainer-and-the-container-of-smx-4-3-tp4615171p4615171.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Diff in classloading of lwcontainer and the container of smx 4.3?

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Yeah, SMX4 is OSGi container  so it use  very different class loader  
mechanism, you may need google to know how OSGi classloader works.


Some quick notes.
1. In OSGi every lib should be bundle, so you shouldn't put log4j.jar  
into the  [smx]/lib, actually smx4 by default install  pax-logging  
bundle which already offer the package like rg.apache.log4j.

2. As you develop BC yourself, you may need take a look some some  
servicemix component(BC, SE) which already adapted as bundle so you  
probably can figure out what's wrong in your component.

Freeman
On 2011-7-20, at 下午4:44, shooding wrote:

> I kept run into ClassNotFoundException of org.apache.log4j,
>
> When developing BC and running the test through spring.xml (like
> servicemix.xml),
> it's a BUILD SUCCESS. But after setup SU, zipped in SA, deployed,  
> still got
> ClassNotFoundException.
>
> Test 1: put log4j.jar into the [smx]/lib/ and restart servicemix  
> doesn't
> help.
> Test 2: try to manually load class("org.apache.log4j") first in my  
> Binding
> Component. The same exception showed.
>
> I wonder if the classloading mechanism is different between  
> lwcontainer and
> the container of smx?
>
> -----
> Industrial Technology Research Institute
> Rm. 226 Bldg. 14, 2F, 195, Sec. 4, Chung Hsing Rd.,
> Chutung, Hsinchu, Taiwan 31040, R.O.C.
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Diff-in-classloading-of-lwcontainer-and-the-container-of-smx-4-3-tp4615171p4615171.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com