VMware Cloud Community
JackBS
Enthusiast
Enthusiast
Jump to solution

vCAC Plug-In createModelEntity failing with java.lang.Double cannot be cast to java.lang.Short

Using vCAC plug-in (5.1) I was trying to create a vCAC PhysicalMachine Entity.  Couple of of attributes in PhysicalMachine Entity are numeric type.

For example: To create a PhysicalMachineEntity I am sending below properties map to createModelEntity

var physicalMachineProps = {

        PhysicalMachineID = "UUID",

        MemoryInMB=1121,

        ProcessorCount=2,

        Vendor="Vendor",

        AssetTag="SDSDSD",

        Model="usrLbl",

        ServiceTag="DN",

        Slot=0

    };

createModelEntity always failing with java.lang.Double cannot be cast to java.lang.Short error. Looks like number type from Rhino always getting converted to java.lang.Double and its failing at plugin. How can we force type to be Short

Any one have seen this. Appreciate any inputs on this.

Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Short

        at org.odata4j.core.OSimpleObjects.create(OSimpleObjects.java:38)

        at org.odata4j.core.OProperties.simple(OProperties.java:54)

        at com.vmware.o11n.plugin.dynamicops.model.support.ODataAccessService.createSimpleProperty(ODataAccessService.java:1012)

        at com.vmware.o11n.plugin.dynamicops.model.support.ODataAccessService.populateSimpleArgument(ODataAccessService.java:934)

        at com.vmware.o11n.plugin.dynamicops.model.support.ODataAccessService.saveEntity(ODataAccessService.java:843)

        at com.vmware.o11n.plugin.dynamicops.model.EntityManager.createModelEntity(EntityManager.java:53)

        at com.vmware.o11n.plugin.dynamicops.model.EntityManager$$FastClassByCGLIB$$5bb4b803.invoke(<generated>)

        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)

        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)

        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

        at com.vmware.o11n.plugin.sdk.spring.impl.CurrentFactoryAnnotationAdvisor$1.call(CurrentFactoryAnnotationAdvisor.java:71)

        at com.vmware.o11n.plugin.sdk.spring.AbstractSpringPluginFactory.doInCurrent(AbstractSpringPluginFactory.java:193)

        at com.vmware.o11n.plugin.sdk.spring.impl.CurrentFactoryAnnotationAdvisor.invoke(CurrentFactoryAnnotationAdvisor.java:67)

        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)

        at com.vmware.o11n.plugin.dynamicops.model.EntityManager$$EnhancerByCGLIB$$93e675fa.createModelEntity(<generated>)

0 Kudos
1 Solution

Accepted Solutions
JackBS
Enthusiast
Enthusiast
Jump to solution

Thanks, Will open a support request. For now workaround is to remove Slot attribute from Properties, then I was able to create PhysicalMachine Entity. But there could be other entities with Int16

View solution in original post

0 Kudos
6 Replies
JackBS
Enthusiast
Enthusiast
Jump to solution

I think this seems to be an issue with Int16 type attributes.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

I am affraid you cannot force the type at the javascript level. This casting issue must be addressed within the plug-in. Please open a support request at VMware Global support services to get a new build that will correct this issue. Please mention bug 1203454 (I created it for making you save some time in the process but it will get prioritized only once you open a support request for it).

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
JackBS
Enthusiast
Enthusiast
Jump to solution

Thanks, Will open a support request. For now workaround is to remove Slot attribute from Properties, then I was able to create PhysicalMachine Entity. But there could be other entities with Int16

0 Kudos
vdimitrov
Contributor
Contributor
Jump to solution

Bug 1203454 has been fixed. You will need the new build for this to work (fixed for both 5.2 and 6.0 versions of the plug-in).

Another thing - if you're creating a new Physical Machine entity, you don't need to specify the PhysicalMachineID, it will be generated for you automatically.

cdecanini_
VMware Employee
VMware Employee
Jump to solution

Thanks Vladimir. Another bug eradicated promptly Smiley Happy

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
JackBS
Enthusiast
Enthusiast
Jump to solution

Yes, you are correct PhysicalMachineID is not required.

Thanks for a quick fix.

0 Kudos