2 Replies Latest reply on Sep 1, 2005 5:58 PM by Ben Wang

    Problem with caching an object with a complex object graph

    renata roginsky Newbie

      This might be a rather involved question, so I'll appreciate any help or idea.
      I'm caching objects with several fields that are ArrayLists of objects of the same class (or classes derived from it). I took care to aspectize (aopc) everything that lies around, or so I believe. Not to mention all of my own classes that are used by the cached objects, I even included these classes in my jboss-aop.xml (out of desperation, I'm sure it doesn't do anything):
      java.util.Date
      java.util.Currency
      java.lang.String
      java.util.ArrayList
      java.math.BigDecimal

      When the objects are first cached, everything seems to be fine, may be because at this point there are no cross-references (most of the ArrayLists fields I mentioned above are empty). Then I create more objects, filling in some of the ArrayLists, and when I try to cache the new objects, now with references, I get this exception:
      java.lang.NullPointerException
      at org.jboss.cache.aop.TreeCacheAop.setRefFqn(TreeCacheAop.java:891)
      at org.jboss.cache.aop.TreeCacheAop.handleObjectGraph(TreeCacheAop.java:530)
      at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:261)
      at org.jboss.cache.aop.TreeCacheAop.putObject(TreeCacheAop.java:136)
      at com.bglobal.commons.cache.impl.jboss.AopTreeAdapter.put(AopTreeAdapter.java:287)
      etc...
      It looks like some object is not found in the Cache where it's expected to be.

      Like I said, I'll appreciate any help, even though I realize this is probably a
      support case. We don't have jBoss support yet, but we will soon, unfortunately this problem can't really wait :-(. Would it make sense to try and make everything Serialized as opposed to aspectizing, just to see if the latter is causing the problem?

      P.S. I'm using version 1.2.3

        • 1. Re: Problem with caching an object with a complex object gra
          jlstrobel9 Newbie

          We are attempting to do something similar with a complex object graph, and having the same problem. In tests, the TreeCacheAOP seems to work with simple data transfer object (DTO) style objects. I.e. java beans with simple set/getters.

          When I try to add an object with relationships to multiple objects, who are in turn related to other objects, I get the same error. The links between nodes are represented by objects which hold references to both the start and endpoint nodes. The links are often bidirectional, i.e. parents are aware of their children, and children are aware of their parents.

          Any ideas would be greatly appreciated. The stack trace follows:



          16:09:38,765 INFO [STDOUT] java.lang.NullPointerException
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop.setRefFqn(TreeCacheAop.java:891)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop.handleObjectGraph(TreeCacheAop.java:530)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:261)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:302)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:302)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:361)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:361)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:302)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:302)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:361)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:361)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:302)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:302)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:361)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:361)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:302)
          16:09:38,765 INFO [STDOUT] at org.jboss.cache.aop.TreeCacheAop.putObject(TreeCacheAop.java:145)

          • 2. Re: Problem with caching an object with a complex object gra
            Ben Wang Master

            OK, to asnwer your questions.

            1. I'd appreciate it if you can reprodouce your problem with junit tests. That helps to troubleshoot and I can also check it in for future regression testing purpose.

            2. In the examples directory (under distro), there are bunch of ObjectGraph tests. Can you take a look first?

            3. I am in 1.2.4 development to resolve issues of more complex object reference interaction between Pojo and Collection classes. Beta is scheduled for 9/12 timeframe. So if 1.2.3 does not suit your need, stay tuned. And you can download the source code to build alpha version, if you can't wait.

            -Ben