5 Replies Latest reply on Aug 24, 2006 8:56 PM by brian.stansberry

    Is TreeCache Serializable?


      Is it??? If it is not, does that mean I cannot use JBoss Caching OUTSIDE of an application server? Currently, here is the error that I get when I do execute it out of an app server -

      Caused by: javax.naming.ConfigurationException [Root exception is java.rmi.MarshalException: error marshalling return; nested exception is:
       java.io.NotSerializableException: org.jboss.cache.TreeCache]
       at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:45)
       at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:77)
       at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:418)
       at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:374)
       at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:359)
       at javax.naming.InitialContext.lookup(InitialContext.java:347)

        • 1. Re: Is TreeCache Serializable?

          Odd, since the treecache is serializable. Which version of JBC are you using? A lot of people bind TreeCache to JNDI, inside JBossAS and in other app servers.

          • 2. Re: Is TreeCache Serializable?

            Hi... I am using 1.4. I infact checked the API documentation, and found that in the tree structure, TreeCache does not implement Serialization. (Its been a while since I coded, so please forgive my ignorance!).

            When I bind the TreeCache and use it within the app server, it works fine (i.e. I look-it-up it using a servlet). However, if I bind it using a weblogic start up class, but look-it-up in a standalone application, it throws me that exception.

            • 3. Re: Is TreeCache Serializable?

              I'm not sure how this works in other app servers, but within JBoss AS the standard technique for binding a cache in JNDI is via JRMPProxyFactory. In that case, it's a (serializable) proxy to the cache that gets bound, not the cache itself.

              TreeCache doesn't implement Serializable, so for sure some kind of proxy would be needed.

              • 4. Re: Is TreeCache Serializable?

                Thanks Stan! I rewrote my app to include a stateless session bean that references the TreeCache and now my app is able to access it. Was there any reason behind not making TreeCache serializable?

                • 5. Re: Is TreeCache Serializable?

                  I wasn't around back in the early days if this was ever discussed, but IMHO it's just not doable in any kind of maintainable way. For example, a cache needs a JChannel, which is not serializable (and can't be in a meaningful way, as it has refs to sockets.)