2 Replies Latest reply on Mar 27, 2006 10:51 AM by Fernando Otero

    Receiving a "null object from internal ref node" when creati

    Fernando Otero Newbie


      I'm trying to create a relationship between 2 cached objects:

      public CachedObject {
       public setParent(CachedObject parent) {

      I start the cache and create 2 objects:

      Fqn fqn1 = new Fqn(new Object[] {"cluster", "object1"});
      cache.putObject(fqn1, new ClusteredObject());
      Fqn fqn2 = new Fqn(new Object[] {"cluster", "object2"});
      cache.putObject(fqn2, new ClusteredObject());

      If I list the cache contents, I get the 2 objects correctly. Then, I try to set the parent in the object2:

      ClusteredObject object1 = (ClusteredObject) cache
       .getObject(new Fqn(new Object[] {"cluster", "object1"}));
      ClusteredObject object2 = (ClusteredObject) cache
       .getObject(new Fqn(new Object[] {"cluster", "object2"}));

      Now, if I try to list the cache contents, I get the following exception:

      Exception in thread "Shell" java.lang.RuntimeException: ObjectGraphHandler.objectGraphGet(): null object from internal ref node. Original fqn: ///cluster/object2/parent Internal ref node: ///cluster/object1
       at org.jboss.cache.aop.ObjectGraphHandler.objectGraphGet(ObjectGraphHandler.java:53)
       at org.jboss.cache.aop.TreeCacheAopDelegate._getObject(TreeCacheAopDelegate.java:66)
       at org.jboss.cache.aop.TreeCacheAop._getObject(TreeCacheAop.java:496)
       at org.jboss.cache.aop.TreeCacheAop.getObject(TreeCacheAop.java:306)
       at org.jboss.cache.aop.CacheInterceptor.invoke(CacheInterceptor.java:114)ClusteredObject[object2,child]
       at org.jboss.aop.joinpoint.FieldReadInvocation.invokeNext(FieldReadInvocation.java:48)
       at cluster.ClusteredObject.friend_r_$aop(ClusteredObject.java)
       at cluster.ClusteredObject.toString(ClusteredObject.java:81)
       at java.lang.String.valueOf(String.java:2577)
       at java.io.PrintStream.print(PrintStream.java:616)
       at java.io.PrintStream.println(PrintStream.java:753)
       at cluster.Command$ListCommand.execute(Command.java:82)
       at cluster.Shell.run(Shell.java:72)

      Am I missing something?

        • 1. Re: Receiving a
          Ben Wang Master

          Difficult to say. But I have one almost identical test case under:


          Can you try it out?

          Or if you can turn your test case in a junit test to run under JBossCache and still be able to repruce it, I then take a quick look.


          • 2. Re: Receiving a
            Fernando Otero Newbie

            I got it! The problem is related to the Fqn that I was using. Unlike my previous post, I was using:

            Fqn fqn1 = new Fqn(new Object[] {"/", "cluster", "object1"});
            Fqn fqn2 = new Fqn(new Object[] {"/", "cluster", "object2"});

            The extra "/" character caused a problem when the cache were trying to retrieve the alias from the refFqn (ObjectGraphHandler class), because all "/" get replaced by "_". In the end, I was getting the wrong Fqn (with a missing "/").

            The test cases worked fine. Thanks!