0 Replies Latest reply on Apr 28, 2013 11:36 AM by adam.kovari

    How to change ClassLoader for object serialization in a Cache obtained through a JNDI from JBoss AS

    adam.kovari

      Hello,

       

      assuming you have a cache defined in the standalone.xml, such as:

              <cache-container name="cdi" default-cache="cdi-cluster" jndi-name="cache/container/cdi">
                  <transport lock-timeout="60000"/>
                  <replicated-cache name="cdi-cluster" mode="SYNC" start="EAGER" batching="true">
                      <transaction mode="NON_XA"/>
                  </replicated-cache>
              </cache-container>

       

       

      in the application, you lookup it using a JNDI InitialContext and try to use, for example:

      org.infinispan.Cache.replace(key, InstanceOfATypeFromTheCurrentApplicationsWAR, InstanceOfATypeFromTheCurrentApplicationsWAR);

       

       

      a ClassLoading exception is thrown - ClassNotFound on the Type from the current WAR. Is it possible to somehow ad the classloader infinispan uses with the Thread.getCurrentThread().getContextClassloader() or any other?

       

       

      Thank you for any ideas.