问题及解决方案:

 1. 构件开发完成后,启动后如何对构件框架结构进行查看?

 问题原因:为便于构件开发者对构件的整体进行把握,需要看到构件的框架结构。

解决方案:在当前构件开发的包中,新建一个HelloWord类,包含main函数,并在函数中对构件进行启动。示例代码如下所示:

启动SmcavsExplorer的代码
    Factory factory = FactoryFactory
            .getFactory(FactoryFactory.SMCAVS_BACKEND);

    HashMap context 
= new HashMap();
    context.put(
"name""Connection");
    context.put(
"definition""ustb.compbase.db.connection.Connection");

    Component root 
= (Component) factory.newComponent(
            
"ustb.smcavs.explorer.BasicSmcavsExplorer", context);
    Smcavs.getLifeCycleController(root).startFc();

错误及处理方法:

1. 无效绑定:不对应的签名。异常内容是:

Exception in thread "main" ustb.smcavs.adl.ADLException: Invalid binding: incompatible signatures (ustb/compbase/db/connection/Connection.smcavs:11)
 at ustb.smcavs.adl.bindings.TypeBindingLoader.checkBinding(TypeBindingLoader.java:119)
 at ustb.smcavs.adl.bindings.BindingLoader.checkBinding(BindingLoader.java:122)
 at ustb.smcavs.adl.bindings.BindingLoader.checkNode(BindingLoader.java:82)
 at ustb.smcavs.adl.bindings.BindingLoader.checkNode(BindingLoader.java:96)
 at ustb.smcavs.adl.bindings.BindingLoader.load(BindingLoader.java:54)
 at ustb.smcavs.adl.bindings.UnboundInterfaceDetectorLoader.load(UnboundInterfaceDetectorLoader.java:58)
 at ustb.smcavs.adl.BasicFactory.newComponent(BasicFactory.java:144)
 at ustb.compbase.db.connection.HelloWorld.main(HelloWorld.java:35)

问题原因:绑定关系无效。

解决方案:检查构件描述文件中的各个节点的definition,signature等相关信息及绑定关系项是否书写正确。

2. 实例化异常:未定义smcavs.provider的值。内容是:

ustb.smcavs.task.core.TaskExecutionException: An error occurs while executing task :"T2476072[CreateTypeTask()]"
 at ustb.smcavs.task.core.BasicScheduler.doSchedule(BasicScheduler.java:112)
 at ustb.smcavs.task.core.BasicScheduler.schedule(BasicScheduler.java:47)
 at ustb.smcavs.adl.BasicFactory.newComponent(BasicFactory.java:161)
 at ustb.compbase.db.connection.HelloWorld.main(HelloWorld.java:35)
Caused by: ustb.smcavs.api.factory.InstantiationException: The smcavs.provider value is not defined
 at ustb.smcavs.util.Smcavs.getBootstrapComponent(Smcavs.java:93)
 at ustb.smcavs.adl.types.SmcavsTypeBuilder.createInterfaceType(SmcavsTypeBuilder.java:68)
 at ustb.smcavs.adl.types.TypeCompiler$CreateTypeTask.execute(TypeCompiler.java:138)
 at ustb.smcavs.task.core.BasicScheduler.doSchedule(BasicScheduler.java:110)
 ... 3 more
Exception in thread "main" ustb.smcavs.adl.ADLException: Unable to execute some of the tasks
 at ustb.smcavs.adl.BasicFactory.newComponent(BasicFactory.java:164)
 at ustb.compbase.db.connection.HelloWorld.main(HelloWorld.java:35)
Caused by: ustb.smcavs.task.core.TaskExecutionException: An error occurs while executing task :"T2476072[CreateTypeTask()]"
 at ustb.smcavs.task.core.BasicScheduler.doSchedule(BasicScheduler.java:112)
 at ustb.smcavs.task.core.BasicScheduler.schedule(BasicScheduler.java:47)
 at ustb.smcavs.adl.BasicFactory.newComponent(BasicFactory.java:161)
 ... 1 more
Caused by: ustb.smcavs.api.factory.InstantiationException: The smcavs.provider value is not defined
 at ustb.smcavs.util.Smcavs.getBootstrapComponent(Smcavs.java:93)
 at ustb.smcavs.adl.types.SmcavsTypeBuilder.createInterfaceType(SmcavsTypeBuilder.java:68)
 at ustb.smcavs.adl.types.TypeCompiler$CreateTypeTask.execute(TypeCompiler.java:138)
 at ustb.smcavs.task.core.BasicScheduler.doSchedule(BasicScheduler.java:110)
 ... 3 more
问题原因:未定义java虚拟机的smcavs运行环境变量。

解决方案:在run configuration中的 arguments标签中的vm auguments文本框内输入:

-Dsmcavs.provider=ustb.smcavs.julia.Julia

点击run,即可。

3. 构件的实现需要实现BindingController 接口,因为构件类型包含客户端接口。

Exception in thread "main" ustb.smcavs.adl.ADLException: Unable to execute some of the tasks
 at ustb.smcavs.adl.BasicFactory.newComponent(BasicFactory.java:164)
 at ustb.compbase.db.operation.HelloWorld.main(HelloWorld.java:35)
Caused by: ustb.smcavs.task.core.TaskExecutionException: An error occurs while executing task :"T6510044[CreateTask(SelectOperation,primitive,ustb.compbase.db.operation.SelectOperation)]"
 at ustb.smcavs.task.core.BasicScheduler.doSchedule(BasicScheduler.java:112)
 at ustb.smcavs.task.core.BasicScheduler.schedule(BasicScheduler.java:47)
 at ustb.smcavs.adl.BasicFactory.newComponent(BasicFactory.java:161)
 ... 1 more
Caused by: InstantiationException: The component implementation class 'ustb.compbase.db.operation.SelectOperation' must implement the BindingController interface, since the component type contains client interfaces
 at ustb.smcavs.julia.generated.C974eb5d4_0.checkFcContentClass(C974eb5d4_0.java:239)
 at ustb.smcavs.julia.generated.C974eb5d4_0.newFcInstance(C974eb5d4_0.java:67)
 at ustb.smcavs.julia.generated.C3bdbaf28_0.newFcInstance(C3bdbaf28_0.java:45)
 at ustb.smcavs.adl.implementations.SmcavsImplementationBuilder.createComponent(SmcavsImplementationBuilder.java:74)
 at ustb.smcavs.adl.implementations.ImplementationCompiler$CreateTask.execute(ImplementationCompiler.java:245)
 at ustb.smcavs.task.core.BasicScheduler.doSchedule(BasicScheduler.java:110)
 ... 3 more
问题原因:构件调用了客户端接口,但没有实现BindingController接口

解决方案:在构件实现代码中implements BindingController接口并实现其相应的方法。

4. 构件Explorer视图中接口和构件的连接线错位,致使看不清楚构件与接口的连接情况。

问题原因:视图中接口的排列顺序为字典顺序,而构件的顺序是按照描述文件中的顺序。

解决方案:因为字典顺序为系统平台确定下来的,可以在构件描述文件中修改构件的顺序,使之与接口的连接顺序一致即可。

 posted on 2010-12-08 14:40  TechNick  阅读(815)  评论(0编辑  收藏  举报