VMware Cloud Community
invhariharan
Contributor
Contributor

DynamicTypes Plugin - Unable to set properties

Hi All, I've configured a DynamicTypes (created a namespace, types and relations) and all went well. I'm able to create an Dynamic Types object as well sucessfully however when I attempt to set one of the properties within the Dynamic type I get the below exception (when trying to invoke to the Find by ID Workflow stub):

java.lang.IllegalArgumentException: Invalid ScriptModule FQN 177356e0-3dfc-4a52-a540-15433795f856 at ch.dunes.model.dunes.ScriptModule.parseFullyQualifiedName(ScriptModule.java:463) at com.vmware.o11n.plugin.dynamictypes.util.CommonUtil.couldBeActionName(CommonUtil.java:85) at com.vmware.o11n.plugin.dynamictypes.repository.DynamicTypesRepository.getTypeBinding(DynamicTypesRepository.java:415) at com.vmware.o11n.plugin.dynamictypes.repository.DynamicTypesRepository.find(DynamicTypesRepository.java:168) at com.vmware.o11n.plugin.dynamictypes.model.DynamicTypesManager.find(DynamicTypesManager.java:112) at com.vmware.o11n.plugin.dynamictypes.DynamicTypesPluginFactory.find(DynamicTypesPluginFactory.java:83) at sun.reflect.GeneratedMethodAccessor422.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ch.dunes.vso.sdk.DirectInvoker.invoke(DirectInvoker.java:57) at ch.dunes.vso.sdk.SDKPluginFactoryInvoker.fetchObject(SDKPluginFactoryInvoker.java:162)

.......

....

From my investigation I can see that all the workflow stubs for this DynamicTypes object are correctly configured... From the above exception it looks like the vro is attempting to reference the workflow id as a script action and fails. The ID referenced in the exception above refers to the correct workflow ID that maps to the Find by ID workflow stub but no idea why it's invoking it as a script action!.

Any clues here would be appreciated...

Many thanks, hari

0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee

Hi Hari,

Actually, this exception is not an error - the code in the plug-in just tries to parse the FQN ID first as a scripting action ID (which fails, and that's why you see this exception in the logs), and if it fails, it will fallback to parsing it as a workflow ID.

Where do you see this exception? If only in the log files, you can ignore it as it should be harmless (except pollution of the logs with unnecessary stack traces).

If the error is not only in the logs but your workflows that using the dynamic type are actually failing at runtime, then there could be some other problem. Could you show some code how you try to set and use these properties? Also, it will be helpful if you provide your dynamic type definitions (assuming there is no confidential info in them) - there is a workflow coming as part of DT plug-in that 'exports' dynamic type definitions as a vRO package, which then in turn can be exported as *.package file.

0 Kudos
invhariharan
Contributor
Contributor

Thanks  Ilian for your quick response.

The basic problem that am facing is that none of the Workflow stubs are getting invoked for my DynamicTypes... and this lead me to take a look at the vco orchestrator logs (am using embedded orchestrator) where the exception was logged (I had turned the debug level to ALL for the Dynamic Types plugin as well). Below is the additional error it throws:

2018-10-10 18:54:01.227+0000 [WorkflowExecutorPool-Thread-6] ERROR {|icds|vharihar@icds.online:DynTypesTest:231cb7df-378f-41aa-97fb-a98d035f67c8:token=3a441767-21b1-4683-98ef-947fbd991e5a} [SCRIPTING_LOG] [DynTypesTest (10/10/18 18:54:00)] Workflow:DynTypesTest / Scriptable task (item1) : java.lang.ClassCastException: ch.dunes.model.type.TypeConverter$NullObject cannot be cast to com.vmware.o11n.plugin.dynamictypes.model.DynamicObject
2018-10-10 18:54:01.227+0000 [WorkflowExecutorPool-Thread-6] WARN {|icds|vharihar@icds.online:DynTypesTest:231cb7df-378f-41aa-97fb-a98d035f67c8:token=3a441767-21b1-4683-98ef-947fbd991e5a} [WorkflowItemTaskRunner] Script execution error on workflow : DynTypesTest / "Scriptable task"(item1) : ch.dunes.model.type.TypeConverter$NullObject cannot be cast to com.vmware.o11n.plugin.dynamictypes.model.DynamicObject
2018-10-10 18:54:01.243+0000 [WorkflowExecutorPool-Thread-6] ERROR {|icds|vharihar@icds.online:DynTypesTest:231cb7df-378f-41aa-97fb-a98d035f67c8:token=3a441767-21b1-4683-98ef-947fbd991e5a} [SCRIPTING_LOG] Workflow execution stack: *** item: "DynTypesTest/item1", state: "failed", business state: "null", exception: "ch.dunes.model.type.TypeConverter$NullObject cannot be cast to com.vmware.o11n.plugin.dynamictypes.model.DynamicObject" workflow: "DynTypesTest" (231cb7df-378f-41aa-97fb-a98d035f67c8) | "output": name=resultObj type=DynamicTypes:Envs.Environments value=null | "no inputs" | "no attributes" *** End of execution stack.

Below is the sample workflow that am invoking to create a Dynamic Type object:

var namespace = "Envs";
var typename = "Environments";

var Environmentsid = '7b998323-06be-4385-9d50-2c0053bc83d8';
var Environmentsname = "myenv";
var status = "UNK";
var launchURI = "UNKK";
System.log("Environmentsid: " + Environmentsid + " Environmentsname: " + Environmentsname + " status: " + status + "Launch URL: " + launchURI);

resultObj = DynamicTypesManager.getObject(namespace, typename, Environmentsid);
if (resultObj != null) {
  System.log("Dynamic Types object created.");
  resultObj.setProperty("status", status);
  resultObj.setProperty("launch_uri", launchURI);
} else {
  System.log("Failed to create the dynamic type! : " + Environmentsid);
}
System.log("status: " + status);
System.log("application_url: " + endpoint);
System.log("statusMessage: " + statusmsg);
System.log("LaunchURI: " + launchURI);

and below is the workflow log (execution failed):

[2018-10-11 00:24:01.203] [I] Environmentsid: 7b998323-06be-4385-9d50-2c0053bc83d8 Environmentsname: myenv status: UNKLaunch URL: UNKK
[2018-10-11 00:24:01.212] [I] Dynamic Types object created.
[2018-10-11 00:24:01.227] [E] Workflow:DynTypesTest / Scriptable task (item1) : java.lang.ClassCastException: ch.dunes.model.type.TypeConverter$NullObject cannot be cast to com.vmware.o11n.plugin.dynamictypes.model.DynamicObject
[2018-10-11 00:24:01.243] [E] Workflow execution stack:
***
item: 'DynTypesTest/item1', state: 'failed', business state: 'null', exception: 'ch.dunes.model.type.TypeConverter$NullObject cannot be cast to com.vmware.o11n.plugin.dynamictypes.model.DynamicObject'
workflow: 'DynTypesTest' (231cb7df-378f-41aa-97fb-a98d035f67c8) 
|  'output': name=resultObj type=DynamicTypes:Envs.Environments value=null
|  'no inputs'
|  'no attributes'
*** End of execution stack.

I'm not sure why the workflow stubs (i.e. find all, find by id, etc,.) are not getting invoked.... Even if I reload "Dynamic Types -> Envs" in the Inventory tab of vRO client I get the same exception.

Let me know if you would require additional info.

Thanks, Hari

0 Kudos
iiliev
VMware Employee
VMware Employee

K, from the logs you provided it looks like DynamicTypeManager.getObject(...) has returned some non-null value, so the stub workflow has been invoked.

For this class cast exception, I should to try to reproduce it in my environment.

1) Which vRO version and build number of DT plug-in do you use?

2) I assume during the definition of your dynamic type you specified as its properties 'status' and 'launch_uri', is this correct?

3) Could you show the content of the stub workflow that finds your object by ID?

0 Kudos
invhariharan
Contributor
Contributor

As I investigated a bit more into this it looks to be a permission issue when it is attempting to invoke the auto generated workflows for the dynamic types. I have a vRA 7.4 with a multi-tenant setup - and have created 1 tenant under which am configuring the Dynamic Types.

To your quetsions:

1) Versions: DynamicTypes 1.3.0.7052852, vRO 7.4.0.8071781

2) Both the properties 'status' and 'launch_id' are specified

3) What I find is that it doesn't even execute the 'Find by ID' workflow due to the permission issue I mentioned.

When I created the Dynamic Types afresh (Namespace, types, relation) then am unable to edit the automate generated workflows... again seems a permission issue.. And I get an exception in the vro logs:

ERROR {} [VcoDelegatingWebFacade] Server Error... ch.dunes.model.sdk.SDKFinderException: Unable to execute "fetchRelation" for type : DynamicNamespaceDefinition : java.lang.NullPointerException at ch.dunes.vso.sdk.SDKFinder.logAndThrow(SDKFinder.java:914) at ch.dunes.vso.sdk.SDKFinder.fetchRelation(SDKFinder.java:387) at ch.dunes.vso.sdk.SDKFinder._findRelation(SDKFinder.java:352) at ch.dunes.vso.sdk.SDKFinder.findRelation(SDKFinder.java:267) at ch.dunes.vso.sdk.ModulesFactory.findRelation(ModulesFactory.java:654) at com.vmware.o11n.sdk.EnhancedScriptingSDK.findRelation(EnhancedScriptingSDK.java:136) at com.vmware.o11n.service.sdk.SdkModuleServiceImpl.findRelation(SdkModuleServiceImpl.java:79) at com.vmware.o11n.service.factory.VcoFactoryFacade.findRelation(VcoFactoryFacade.java:1902) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)

is there anything we need to consider when using Dynamic Types in a multi-tenant mode?

Thanks, hari

0 Kudos