VMware {code} Community
dmcdougald
Contributor
Contributor

InstantiateVappTemplate - No access to entity

I've been having good luck with the API so far but ran into an issue trying to instantiate a vApp from a template, using version 1.5.1. InstantiatevAppTemplate() throws a VCloudException with the message - No access to entity \"com.vmware.vcloud.entity.vapptemplate:blahblahblah"  I'm logged in as an OrganizationAdmin.  So I don't believe permissions is an issue.  The same user can create vApps through the Web interface with no issues.

I'm using NewvAppFromTemplate() method from teh HellovCloud example.  Any help is greatly appreciated.

6 Replies
dmcdougald
Contributor
Contributor

Anybody have any idea?  I'm completely blocked by this.

0 Kudos
Todor_Todorov
Hot Shot
Hot Shot

Is the vApp template added to a Catalog as a Catalog Item? In order to instantiate a vApp template, it has to be added to a Catalog.

Regards,

Todor Todorov

0 Kudos
dmcdougald
Contributor
Contributor

Yes.  This template is in a catalog.

0 Kudos
Nikolai_
Contributor
Contributor

Hello,

I have the same issue. Just started with VCloud. I'm using console and the Java sdk and can not fugure out what's wrong.

Through the console I can instantiate vApp from template.

Using the SDK with the same user the error is:

<Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="ACCESS_TO_RESOURCE_IS_FORBIDDEN" message="No access to entity &quot;com.vmware.vcloud.entity.vapptemplate:a74809a7-0255-4757-bfae-796f99e003d7&quot;." majorErrorCode="403" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://devwdfcloud01.wdf.sap.corp/api/v1.5/schema/master.xsd"></Error>

The code does this:

login,

find vdc,

find catalog,

find catalog by reference,

catalog.getCatalogItemReferences(),

and for paticular reference - instantiate (instantiation is from SDK examples HelloVCloud newvAppFromTemplate)

Regards,

Nikolai

0 Kudos
Todor_Todorov
Hot Shot
Hot Shot

Hi Nikolai_,

The problem is in the way you're obtaining the href of the vApp template from the catalog item.

Regards,

Todor Todorov

Nikolai_
Contributor
Contributor

Yes, the problem was that the href was taken directly from the item.

Solution is  instead of instVappTemplParams.setSource(catalogItem.getHref());

use:

ref = catalogItem.getResource().getEntity();

instVappTemplParams.setSource(ref);

Thanks,

Nikolai

0 Kudos