Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

SharedModel, shared property error

Avatar

Level 3

My sharedproperty works fine, however, I alwasy get this exception when I start my program.

I basically extended a button and turned into a "SharedButton"

Error: Could not find the requested node.
    at com.adobe.rtc.sharedModel::CollectionNode/getNodeConfiguration()[D:\Program Files\Adobe\Flex Builder 3.1\plugins\com.adobe.afcs\libs\player9\src\com\adobe\rtc\sharedModel\CollectionNode.as:394]
    at com.adobe.rtc.sharedModel::SharedProperty/commitProperties()[D:\Program Files\Adobe\Flex Builder 3.1\plugins\com.adobe.afcs\libs\player9\src\com\adobe\rtc\sharedModel\SharedProperty.as:615]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.util::Invalidator/onInvalidationComplete()[D:\Program Files\Adobe\Flex Builder 3.1\plugins\com.adobe.afcs\libs\player9\src\com\adobe\rtc\util\Invalidator.as:61]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.utils::Timer/tick()

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi ,

I found the problem :). So, basically when you do _sharedButton.publishModel in your code, the model is not synchronized by then and the node is not created the first time. This error is only used to happen when you will run the app the first time in a room. So, on your side, you need to wait till the SharedProperty is synchronized to be on safe side, and our side I will fix it so that it doesn’t throw the exception even the first time.

I am attaching your code modified with the changes. Thanks for reporting.

Hope this helps.

Regards

Hironmay Basu

// ActionScript file

package

{

import com.adobe.rtc.events.CollectionNodeEvent;

import com.adobe.rtc.events.SharedPropertyEvent;

import com.adobe.rtc.messaging.UserRoles;

import com.adobe.rtc.sharedModel.SharedProperty;

import flash.events.MouseEvent;

import mx.controls.Button;

public class SharedButton extends Button

{

public function SharedButton()

{

super();

}

protected var _sharedButton:SharedProperty;

override protected function createChildren():void

{

super.createChildren();

toggle = true;

_sharedButton = new SharedProperty();

_sharedButton.sharedID = id;

_sharedButton.subscribe();

sharedButton.addEventListener(CollectionNodeEvent.SYNCHRONIZATIONCHANGE,onSyncChange);

addEventListener(MouseEvent.CLICK, onLocalClick);

_sharedButton.addEventListener(SharedPropertyEvent.CHANGE, onRemoteClick);

}

protected function onSyncChange(p_evt:CollectionNodeEvent):void

{

if ( _sharedButton.isSynchronized ) {

_sharedButton.publishModel = UserRoles.PUBLISHER ;

}

}

protected function onLocalClick(p_evt:MouseEvent):void

{

_sharedButton.value = selected;

}

protected function onRemoteClick(s_evt:SharedPropertyEvent):void

{

selected = _sharedButton.value;

}

}

}

View solution in original post

4 Replies

Avatar

Former Community Member

Just from exception, it is hard to tell why you are getting the exception. Can you attach an example with your sharedbutton code that reproduces this ?

Thanks

Hironmay Basu

Avatar

Level 3

This is a copy of SharedButton.as

Thank you.

package
{
    import com.adobe.rtc.events.SharedPropertyEvent;
    import com.adobe.rtc.messaging.UserRoles;
    import com.adobe.rtc.sharedModel.SharedProperty;
   
    import flash.events.MouseEvent;
   
    import mx.controls.Button;

    public class SharedButton extends Button
    {
        public function SharedButton()
        {
            super();
        }
       
        protected var _sharedButton:SharedProperty;
       
        override protected function createChildren():void
        {
            super.createChildren();
            toggle = true;
            _sharedButton = new SharedProperty();           
            _sharedButton.publishModel = UserRoles.PUBLISHER;
            _sharedButton.sharedID = id;

            _sharedButton.subscribe();
            addEventListener(MouseEvent.CLICK, onLocalClick);
            _sharedButton.addEventListener(SharedPropertyEvent.CHANGE, onRemoteClick);
        }
       
        protected function onLocalClick(p_evt:MouseEvent):void
        {           
            _sharedButton.value = selected;
        }
       
        protected function onRemoteClick(s_evt:SharedPropertyEvent):void
        {
            selected = _sharedButton.value;
        }
               
    }
}

I then instantiate it like this...

<l:SharedButton id="_mybutton" label="My shared button" />

Thanks again for your help

Avatar

Correct answer by
Former Community Member

Hi ,

I found the problem :). So, basically when you do _sharedButton.publishModel in your code, the model is not synchronized by then and the node is not created the first time. This error is only used to happen when you will run the app the first time in a room. So, on your side, you need to wait till the SharedProperty is synchronized to be on safe side, and our side I will fix it so that it doesn’t throw the exception even the first time.

I am attaching your code modified with the changes. Thanks for reporting.

Hope this helps.

Regards

Hironmay Basu

// ActionScript file

package

{

import com.adobe.rtc.events.CollectionNodeEvent;

import com.adobe.rtc.events.SharedPropertyEvent;

import com.adobe.rtc.messaging.UserRoles;

import com.adobe.rtc.sharedModel.SharedProperty;

import flash.events.MouseEvent;

import mx.controls.Button;

public class SharedButton extends Button

{

public function SharedButton()

{

super();

}

protected var _sharedButton:SharedProperty;

override protected function createChildren():void

{

super.createChildren();

toggle = true;

_sharedButton = new SharedProperty();

_sharedButton.sharedID = id;

_sharedButton.subscribe();

sharedButton.addEventListener(CollectionNodeEvent.SYNCHRONIZATIONCHANGE,onSyncChange);

addEventListener(MouseEvent.CLICK, onLocalClick);

_sharedButton.addEventListener(SharedPropertyEvent.CHANGE, onRemoteClick);

}

protected function onSyncChange(p_evt:CollectionNodeEvent):void

{

if ( _sharedButton.isSynchronized ) {

_sharedButton.publishModel = UserRoles.PUBLISHER ;

}

}

protected function onLocalClick(p_evt:MouseEvent):void

{

_sharedButton.value = selected;

}

protected function onRemoteClick(s_evt:SharedPropertyEvent):void

{

selected = _sharedButton.value;

}

}

}

Avatar

Level 3

Thanks for the wonderful effort and the quick responses... Have a good day.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----