1 Reply Latest reply on Jun 2, 2008 7:39 AM by Manik Surtani

    Bad registration of class loader

    Yair Zaslavsky Newbie

      Hi all, I have a class that wrapps "get" and "put" of TreeCacheMBean (The class gets an object of TreeCacheMBean using the code:

      MBeanServer server=MBeanServerLocator.locateJBoss();
      TreeCacheMBean cache=(TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, "jboss.cache:service=TreeCache", server);
      

      )
      When i invoke the get and put methods I get the exception:

      java.lang.RuntimeException: java.lang.ClassNotFoundException: No ClassLoaders found for: com.cellerium.logicsrv.logic.resource.data.BinaryResource
       at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5875)
       at org.jboss.cache.TreeCache.put(TreeCache.java:3833)
       at org.jboss.cache.TreeCache.put(TreeCache.java:3774)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy243.put(Unknown Source)
       at com.cellerium.logicsrv.logic.resource.fetchers.CASCache.putResource(CASCache.java:84)
       at com.cellerium.logicsrv.logic.resource.fetchers.ResourceFetcherImpl.fetchResourceImpl(ResourceFetcherImpl.java:321)
       at com.cellerium.logicsrv.logic.resource.fetchers.ResourceFetcher.fetchResource(ResourceFetcher.java:34)
       at com.cellerium.logicsrv.logic.controls.components.data.ImageComponentData.fetchImages(ImageComponentData.java:502)
       at com.cellerium.logicsrv.logic.controls.components.data.ImageComponentData.fetchResources(ImageComponentData.java:465)
       at com.cellerium.logicsrv.logic.controls.components.entity.ItemList.fetchAndPlaceInResourceContainer(ItemList.java:193)
       at com.cellerium.logicsrv.logic.protocol.response.serialize.DataContainer.fetchResourcesForPage(DataContainer.java:198)
       at com.cellerium.logicsrv.logic.protocol.response.serialize.DataContainer.fetchResourcesForPages(DataContainer.java:76)
       at com.cellerium.logicsrv.logic.protocol.request.data.getpages.GetPagesRequest.invoke(GetPagesRequest.java:199)
       at com.cellerium.logicsrv.logic.protocol.request.invoker.manager.RequestInvoker.invoke(RequestInvoker.java:41)
       at com.cellerium.gwservlet.GWServlet.doPost(GWServlet.java:146)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.cellerium.logicsrv.logic.resource.data.BinaryResource
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
       at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:585)
       at org.jboss.invocation.MarshalledValueInputStream.resolveClass(MarshalledValueInputStream.java:109)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
       at java.util.HashMap.readObject(HashMap.java:1067)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
       at org.jboss.cache.loader.FileCacheLoader.loadAttributes(FileCacheLoader.java:486)
       at org.jboss.cache.loader.FileCacheLoader.put(FileCacheLoader.java:151)
       at org.jboss.cache.loader.ChainingCacheLoader.put(ChainingCacheLoader.java:149)
       at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:216)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
       at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:212)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
       at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
       at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:365)
       at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:160)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
       at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:157)
       at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5863)
       ... 44 more



      I did use "registerClassLoader" (in my wrapping class i have an init method that performs:

      treeCache.registerClassLoader("/", this.getClass().getClassLoader());



      Can anyone tell me why i am getting this exception?


        • 1. Re: Bad registration of class loader
          Manik Surtani Master

          What version of JBoss Cache are you using? Could be that the FileCacheLoader in question does not make use of any region based class loaders. I'd recommend either the latest 2.1.X release or 1.4.X service pack if you need to be on 1.4.X.

          Alternatively, if your project jars are on your system classpath you won't see these errors, but that is not always a nice workaround. :)