模拟器上运行Flex手机工程(采用Parsley框架)报错如下:
INFO: Initialize Flex Support
Error #2044: Unhandled error:. text=Error building Context - cause: Error: One or more errors in BootstrapProcessor: 1 cause(s)
at org.spicefactory.parsley.core.bootstrap.impl::DefaultBootstrapProcessor/handleErrors()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/bootstrap/impl/DefaultBootstrapProcessor.as:138]
at org.spicefactory.parsley.core.bootstrap.impl::DefaultBootstrapProcessor/invokeNextProcessor()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/bootstrap/impl/DefaultBootstrapProcessor.as:99]
at org.spicefactory.parsley.core.bootstrap.impl::DefaultBootstrapProcessor/invokeNextProcessor()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/bootstrap/impl/DefaultBootstrapProcessor.as:113]
at org.spicefactory.parsley.core.bootstrap.impl::DefaultBootstrapProcessor/process()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/bootstrap/impl/DefaultBootstrapProcessor.as:81]
at org.spicefactory.parsley.flex.tag.builder::ContextBuilderTag/createContext()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/flex/org/spicefactory/parsley/flex/tag/builder/ContextBuilderTag.as:301]
at org.spicefactory.parsley.flex.tag.builder::ContextBuilderTag/executeAction()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/flex/org/spicefactory/parsley/flex/tag/builder/ContextBuilderTag.as:272]
at org.spicefactory.parsley.flex.tag::ConfigurationTagBase/addedToStage()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/flex/org/spicefactory/parsley/flex/tag/ConfigurationTagBase.as:104]
at flash.display::DisplayObjectContainer/addChildAt()
at mx.managers::SystemManager/preloader_preloaderDoneHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2664]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/displayClassCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:582]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at spark.preloaders::SplashScreen/dispatchComplete()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\preloaders\SplashScreen.as:545]
at spark.preloaders::SplashScreen/preloader_initCompleteHandler()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\preloaders\SplashScreen.as:514]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/dispatchAppEndEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:380]
at mx.preloaders::Preloader/appCreationCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:590]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
Cause(0): [null: Initialization of [ObjectDefinition(type = com.service::RemoteService, id = _AppConfig_RemoteService1)] failed - cause: Error: Required object of type [class EntryModel] does not exist
at org.spicefactory.parsley.core.builder.ref::ObjectTypeReference/resolve()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/builder/ref/ObjectTypeReference.as:87]
at org.spicefactory.parsley.core.builder.ref::ImplicitObjectTypeReference/resolve()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/builder/ref/ImplicitObjectTypeReference.as:58]
at ManagedObjectImpl/resolveValue()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/lifecycle/impl/DefaultManagedObjectHandler.as:243]
at org.spicefactory.parsley.core.builder.processor::PropertySetterProcessor/init()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/builder/processor/PropertySetterProcessor.as:58]
at org.spicefactory.parsley.core.lifecycle.impl::DefaultManagedObjectHandler/invokeInitMethods()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/lifecycle/impl/DefaultManagedObjectHandler.as:157]
at org.spicefactory.parsley.core.lifecycle.impl::DefaultManagedObjectHandler/configureObject()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/lifecycle/impl/DefaultManagedObjectHandler.as:116]
at org.spicefactory.parsley.core.context.impl::DefaultContext/getInstance()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/context/impl/DefaultContext.as:395]
at org.spicefactory.parsley.core.context.impl::InitializerSequence/createInstances()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/context/impl/InitializerSequence.as:114]
at org.spicefactory.parsley.core.context.impl::InitializerSequence/start()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/context/impl/InitializerSequence.as:74]
at org.spicefactory.parsley.core.context.impl::DefaultContext/initializeSingletons()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/context/impl/DefaultContext.as:133]
at org.spicefactory.parsley.core.context.impl::DefaultContext/checkIfInitialized()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/context/impl/DefaultContext.as:144]
at org.spicefactory.parsley.core.context.impl::DefaultContext/registryFrozen()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/context/impl/DefaultContext.as:113]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.spicefactory.parsley.core.registry.impl::DefaultObjectDefinitionRegistry/freeze()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/registry/impl/DefaultObjectDefinitionRegistry.as:209]
at org.spicefactory.parsley.core.bootstrap.impl::DefaultBootstrapProcessor/invokeNextProcessor()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/bootstrap/impl/DefaultBootstrapProcessor.as:96]
at org.spicefactory.parsley.core.bootstrap.impl::DefaultBootstrapProcessor/invokeNextProcessor()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/bootstrap/impl/DefaultBootstrapProcessor.as:113]
at org.spicefactory.parsley.core.bootstrap.impl::DefaultBootstrapProcessor/process()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/core/kernel-api/org/spicefactory/parsley/core/bootstrap/impl/DefaultBootstrapProcessor.as:81]
at org.spicefactory.parsley.flex.tag.builder::ContextBuilderTag/createContext()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/flex/org/spicefactory/parsley/flex/tag/builder/ContextBuilderTag.as:301]
at org.spicefactory.parsley.flex.tag.builder::ContextBuilderTag/executeAction()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/flex/org/spicefactory/parsley/flex/tag/builder/ContextBuilderTag.as:272]
at org.spicefactory.parsley.flex.tag::ConfigurationTagBase/addedToStage()[/Users/jenshalm/Projects/Spicefactory3/Parsley-Core/src/flex/org/spicefactory/parsley/flex/tag/ConfigurationTagBase.as:104]
at flash.display::DisplayObjectContainer/addChildAt()
at mx.managers::SystemManager/preloader_preloaderDoneHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2664]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/displayClassCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:582]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at spark.preloaders::SplashScreen/dispatchComplete()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\preloaders\SplashScreen.as:545]
at spark.preloaders::SplashScreen/preloader_initCompleteHandler()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\preloaders\SplashScreen.as:514]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/dispatchAppEndEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:380]
at mx.preloaders::Preloader/appCreationCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:590]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]]
经排查,是Parsely配置问题导致的。这类报错基本上都是Parsely配置导致的。
Cause(0): [null: Initialization of [ObjectDefinition(type = com.service::RemoteService, id = _AppConfig_RemoteService1)] failed - cause: Error: Required object of type [class EntryModel] does not exist
根据上述的报错中的信息,应该是Parsley配置文件中缺少EntryModel配置。
现摘录ParselyHelloWorld中部分代码,做为参考。
1.>
<fx:Declarations>
<parsley:ContextBuilder config="HelloWorldConfig" />
</fx:Declarations>
2.>
HelloWorldConfig.mxml
<?xml version="1.0" encoding="utf-8"?>
<Objects
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns="http://www.spicefactory.org/parsley"
xmlns:hw="org.spicefactory.parsley.sample.helloworld.*">
<fx:Declarations>
<hw:SendModel/>
<hw:ReceiveModel/>
<hw:SharedModel/>
</fx:Declarations>
</Objects>