6 Replies Latest reply on May 15, 2009 5:18 AM by ekobir

    Replication, CacheMarshaller, Region

      Hi All

      As I would like to store some custom externalizable classes in the cache, i created region on the cache. But it didnt help me not to get ClassNotFoundException.

      Scenario exactly as explained in faq.
      http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.3.GA/faq_en/html_single/index.html#d0e666

      I'm using JBoss EAP 5.0.0 (Only supported version available). It uses jbosscache 3.0,3GA. My jboss-beans.xml file under META-INF of ear file. So when class is loaded,
      cache will be created on that server.

      My Question is

      What is the best way for handling class loader problem?
      Do I need to write a Marshaller from scratch or is there any delegation available for application to provide class loader?



      please find cache configuration below.

      <!-- First we create a Configuration object for the cache -->
       <bean name="ConfigurationCacheConfig"
       class="org.jboss.cache.config.Configuration">
       <!-- Externally injected services -->
       <property name="runtimeConfig">
       <bean class="org.jboss.cache.config.RuntimeConfig">
       <property name="transactionManager">
       <inject bean="jboss:service=TransactionManager"
       property="TransactionManager"/>
       </property>
       <property name="muxChannelFactory">
       <inject bean="JChannelFactory"/>
       </property>
       </bean>
       </property>
      
       <property name="multiplexerStack">udp</property>
       <property name="clusterName">
       ${jboss.partition.name:DefaultPartition}-ConfigurationCache
       </property>
       <property name="nodeLockingScheme">OPTIMISTIC</property>
       <property name="isolationLevel">NONE</property>
       <property name="cacheMode">REPL_SYNC</property>
       <property name="stateRetrievalTimeout">15000</property>
       <property name="syncReplTimeout">20000</property>
       <property name="lockAcquisitionTimeout">15000</property>
       <property name="exposeManagementStatistics">true</property>
      
       <property name="cacheLoaderConfig">
       <bean class="org.jboss.cache.config.CacheLoaderConfig">
       <!-- Do not change these TODO it was true -->
       <property name="passivation">false</property>
       <property name="shared">false</property>
      
       <property name="individualCacheLoaderConfigs">
       <list>
       <bean class="org.jboss.cache.loader.FileCacheLoaderConfig">
       <!-- Where passivated sessions are stored -->
       <property name="location">${jboss.server.data.dir}${/}session</property>
       <!-- Do not change these -->
       <property name="async">false</property>
       <property name="fetchPersistentState">true</property>
       <property name="purgeOnStartup">true</property>
       <property name="ignoreModifications">false</property>
       <property name="checkCharacterPortability">false</property>
       </bean>
       </list>
       </property>
       </bean>
       </property>
       </bean>
      
       <!-- Factory to build the Cache. -->
       <bean name="DefaultCacheFactory" class="org.jboss.cache.DefaultCacheFactory">
       <constructor factoryClass="org.jboss.cache.DefaultCacheFactory"
       factoryMethod="getInstance" />
       </bean>
       <!--The cache itself-->
       <bean name="ConfigurationCache" class="org.jboss.cache.Cache">
       <constructor factoryMethod="createCache">
       <factory bean="DefaultCacheFactory"/>
       <parameter class="org.jboss.cache.config.Configuration"><inject bean="ConfigurationCacheConfig"/></parameter>
       <parameter class="boolean">false</parameter>
       </constructor>
       </bean>
      


        • 1. Re: Replication, CacheMarshaller, Region

          I forgot to mention that setUseRegionBasedMarshallin is deprecated in the javadoc. According to javadoc, we should be doing following
          " With isUseLazyDeserialization(), which is enabled by default, custom class loaders are handled implicitly. See the user guide for details on how this is handled. "

          On the other hand I checked AbstractMarshaller under Tag 3.0.3GA and it includes following code...

          @Start
          @SuppressWarnings("deprecation")
          protected void init()
          {
          this.useRegionBasedMarshalling = configuration.isUseRegionBasedMarshalling();
          this.defaultInactive = configuration.isInactiveOnStartup();
          }

          Am I missing something? please help.





          • 2. Re: Replication, CacheMarshaller, Region
            manik

            CNFE? Have you set a special class loader on your region or something?

            • 3. Re: Replication, CacheMarshaller, Region

              Hi Manik

              I was trying to use the configuration file in the first message as it is. When I deploy application on the second node, cache tries replicate itself but it is not able to find the correct class.
              As I'm using jboss EAP 5.0.0, then i tried follow faq 2,35 and 2.38 but so far no luck to get it work...

              Do you suggest that I should upgrade version to 3.1.0Ga?

              • 4. Re: Replication, CacheMarshaller, Region
                richsharples

                @ekobir if you have access to EAP 5.0.0 Alpha then you are a Red Hat customer so you should be able to get developer-level support from Red Hat directly - did you try that.

                Rich Sharples
                JBoss, a division of Red Hat

                • 5. Re: Replication, CacheMarshaller, Region

                  Hi Rich

                  Thanks for suggestion. I'm trying to use forums for development problems before disturbing red hat customer support.

                  I think(not sure as I have other problems such as
                  http://www.jboss.org/index.html?module=bb&op=viewtopic&t=155517 ) adding following line int the config fixed my problem regarding cache.

                  true

                  Thanks

                  • 6. Re: Replication, CacheMarshaller, Region

                     

                    <property name="useLazyDeserialization">
                    true
                    </property>