1 Reply Latest reply on May 2, 2011 1:20 PM by Daryl Olson

    ClassNotFoundException in BundleLoader

    Daryl Olson Newbie

      During normal operation, I am getting the following exception:

       

      09:53:42,983 | WARN  | tenerContainer-1 | DefaultMessageListenerContainer  | 95 - org.springframework.jms - 3.0.5.RELEASE |

      Execution of JMS message listener failed, and no ErrorHandler has been set.

      org.apache.camel.RuntimeCamelException: net.sf.ehcache.CacheException:

      When configured copyOnRead or copyOnWrite, a Store will only accept Serializable values

           at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

      ...

      Caused by: net.sf.ehcache.CacheException: When configured copyOnRead or copyOnWrite, a Store will only accept Serializable values

           at net.sf.ehcache.store.compound.ReadWriteSerializationCopyStrategy.copyForRead(ReadWriteSerializationCopyStrategy.java:85)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.store.compound.ReadWriteSerializationCopyStrategy.copyForRead(ReadWriteSerializationCopyStrategy.java:33)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.store.compound.Segment.potentiallyCopyForRead(Segment.java:187)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.store.compound.Segment.decode(Segment.java:179)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.store.compound.Segment.get(Segment.java:229)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.store.compound.CompoundStore.get(CompoundStore.java:169)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.store.compound.CompoundStore.getQuiet(CompoundStore.java:176)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.Cache.searchInStoreWithoutStats(Cache.java:1925)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at net.sf.ehcache.Cache.get(Cache.java:1547)[531:wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2:0]

           at ca.netenergy.dao.cache.ListCacheManager.getList(ListCacheManager.java:42)[534:wrap_mvn_ca.netenergy_ne-dao_1.6:0]

           at ca.netenergy.dao.MarketDaoImpl.getMarket(MarketDaoImpl.java:229)[534:wrap_mvn_ca.netenergy_ne-dao_1.6:0]

           at ca.ne2.integration.trade.capture.process.NeExchangeEnhancementHelper.lookupMarket(NeExchangeEnhancementHelper.java:200)[528:ne-fix-trade-capture-process:1.0.02.SNAPSHOT]

      ...

      Caused by: java.lang.ClassNotFoundException: ca.netenergy.necommons.domain.Market

           at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)[osgi-3.6.0.v20100517.jar:]

       

      I have unit tests which uses the MarketDaoImpl and Market classes and does load the ListCacheManager.

      These work fine so I'm sure it is not a serialization problem.

       

      Based on the last cause in the stack trace, ca.netenergy.necommons.domain.Market is not being found by the BundleLoader.

       

      The bundles involved here are:

       

      503: wrap_mvn_ca.netenergy_necommons_1.21 (contains Market, the class not found)

       

      531      wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2 (the net.sf.ehcache stuff)

       

      528      FIX Trade Capture Report Process (contains NeExchangeEnhancementHelper and the Camel Route in use during the exception)

       

      534      wrap_mvn_ca.netenergy_ne-dao_1.6 (contains MarketDaoImpl, ListCacheManager)

       

      More possibly useful information:

       

      528 FIX Trade Capture Report Process

      imports packages:

       

      ca.netenergy.dao,version=0.0.0 from wrap_mvn_ca.netenergy_ne-dao_1.6 (534)

      ca.netenergy.necommons.domain,version=0.0.0 from wrap_mvn_ca.netenergy_necommons_1.21 (503)

      ca.netenergy.necommons.messaging,version=0.0.0 from wrap_mvn_ca.netenergy_necommons_1.21 (503)

       

      503: wrap_mvn_ca.netenergy_necommons_1.21

      imports bundles:

       

      ne-fix-trade-capture-process (528)

      wrap_mvn_ca.netenergy_ne-dao_1.6 (534)

       

      534      wrap_mvn_ca.netenergy_ne-dao_1.6

      imports packages:

       

      ca.netenergy.necommons.domain,version=0.0.0 from wrap_mvn_ca.netenergy_necommons_1.21 (503)

      ca.netenergy.necommons.event,version=0.0.0 from wrap_mvn_ca.netenergy_necommons_1.21 (503)

      ca.netenergy.necommons.fix,version=0.0.0 from wrap_mvn_ca.netenergy_necommons_1.21 (503)

      net.sf.ehcache,version=0.0.0 from wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2 (531)

      net.sf.ehcache.config,version=0.0.0 from wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2 (531)

      net.sf.ehcache.store,version=0.0.0 from wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2 (531)

       

      imports bundles:

       

      ne-fix-trade-capture-process (528)

       

      531      wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2

      imports bundles:

       

      wrap_mvn_ca.netenergy_ne-dao_1.6 (534)

       

      Does anyone have any ideas as to why the Market class is not being found? Any ides on how to resolve this issue?

       

      Thanks,

      Daryl

        • 1. Re: ClassNotFoundException in BundleLoader
          Daryl Olson Newbie

          Looking closer at the stack trace, I figured out the problem and how to solve it.

           

          Basically the problem is:

           

          The call ListCacheManager.getList()

           

          in bundle

           

          calls

           

          Cache.get()

           

          in bundle

           

          which ends up needing to use:

           

          ca.netenergy.necommons.domain.Market

           

          from the bundle:

           

          wrap_mvn_ca.netenergy_necommons_1.21 (503)

           

          The problem is, bundle:

           

           

          does not import the bundle

           

          wrap_mvn_ca.netenergy_necommons_1.21 (503)

           

          so the BundleLoader cannot find the class.

           

          To resolve this, I needed a Fragment that has:

           

          <Fragment-Host>wrap_mvn_net.sf.ehcache_ehcache-core_2.4.2</Fragment-Host>

          <Import-Package>

          ca.netenergy.necommons,

          ca.netenergy.necommons.domain,

          ca.netenergy.necommons.event,

          ca.netenergy.necommons.fix,

          ca.netenergy.necommons.fix.exception,

          ca.netenergy.necommons.messaging                    

          </Import-Package>

           

          Daryl