1

I'm trying to connect an azure blob container through an Genexus 17 based application (Java) that acts like an API between an ERP and the blob container. The connection by code is:

&dadosConsumoAzureSDT = new()
&dadosConsumoAzureSDT = dadosConsumoAzureProver.Udp()

&Properties = new()
&Properties.Set("PUBLIC_CONTAINER_NAME", &dadosConsumoAzureSDT.container+"_public")
&Properties.Set("PRIVATE_CONTAINER_NAME", &dadosConsumoAzureSDT.container)
&Properties.Set("ACCOUNT_NAME", &dadosConsumoAzureSDT.StorageAccountName)
&Properties.Set("ACCOUNT_KEY", &dadosConsumoAzureSDT.StorageAccountKey)

if &ExternalStorage.Create(StorageProviderType.Microsoft_Azure, &Properties, &Storage, &Messages)
    
    &StorageObjectFullName = "master/hotfolder/" + &filename
    
    if (&Storage.UploadPrivate(&File.GetAbsoluteName(), &StorageObjectFullName, &UploadedFile, &Messages))
        msg(format('URL of the uploaded file : %1', &UploadedFile.GetAbsoluteName()), status)
    else
        for &Message in &Messages
            msg(&Message.Description,status)
        endfor
    endif
    
    &ExpirationMinutes = 1
    if (&Storage.GetPrivate(&StorageObjectFullName, &ExternalFile, &ExpirationMinutes, &Messages))
        &URL = &ExternalFile.GetURI()
    else
        for &Message in &Messages
            msg(&Message.Description,status)
        endfor
    endif
    
else    
    for &Message in &Messages
        msg(&Message.Description,status)
    endfor
endif

However, the log file returns the following error

class java.lang.NullPointerException Cannot invoke "com.microsoft.azure.storage.blob.CloudBlobContainer.getBlockBlobReference(String)" because "this.privateContainer" is null

So, my doubt is about the Properties syntax (PUBLIC_CONTAINER_NAME, PRIVATE_CONTAINER_NAME, etc...), but I cannot find anything on the Genexus wiki. I tried to set the container data connection in the Storage Provider properties, through the KB's generator, but the same error happens.

0 Answers0