Azure-Samples / media-services-v3-java

Azure Media Service v3 Java SDK samples
MIT License
8 stars 18 forks source link

Not able to compile Video encoding sample with custom/predefined preset #85

Closed yugandhar02 closed 2 years ago

yugandhar02 commented 2 years ago

Minimal steps to reproduce

try running mvn clean compile

Any log messages given by the failure

>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project EncodingWithMESPredefinedPreset: Compilation failure: Compilation failure:
[ERROR] /media-services-v3-java/VideoEncoding/EncodingWithMESPredefinedPreset/src/main/java/sample/EncodingWithMESPredefinedPreset.java:[15,30] package com.azure.storage.blob does not exist
[ERROR] /media-services-v3-java/VideoEncoding/EncodingWithMESPredefinedPreset/src/main/java/sample/EncodingWithMESPredefinedPreset.java:[16,30] package com.azure.storage.blob does not exist
[ERROR] /media-services-v3-java/VideoEncoding/EncodingWithMESPredefinedPreset/src/main/java/sample/EncodingWithMESPredefinedPreset.java:[17,30] package com.azure.storage.blob does not exist
[ERROR] -> [Help 1]

Expected/desired behavior

Should compile without any error

OS and Version?

macOS big sur

Versions

Mention any other details that might be useful

After adding

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.azure</groupId>
                <artifactId>azure-sdk-bom</artifactId>
                <version>1.0.3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
          </dependencies>
    </dependencyManagement>

     <dependencies>
          <dependency>
               <groupId>com.azure</groupId>
                <artifactId>azure-storage-blob</artifactId>
          </dependency>
      <dependencies>

it compiles successfully but on executing "mvn exec:java" gets below error

java.lang.RuntimeException: java.io.IOException: java.lang.NoClassDefFoundError: com/nimbusds/oauth2/sdk/http/CommonContentTypes
    at rx.exceptions.Exceptions.propagate(Exceptions.java:57)
    at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:463)
    at rx.observables.BlockingObservable.first(BlockingObservable.java:166)
    at sample.EncodingWithMESCustomPreset.createCustomTransform(EncodingWithMESCustomPreset.java:226)
    at sample.EncodingWithMESCustomPreset.runEncodingWithMESCustomPreset(EncodingWithMESCustomPreset.java:107)
    at sample.EncodingWithMESCustomPreset.main(EncodingWithMESCustomPreset.java:70)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
ankumalh commented 2 years ago

edit pom to add this dep mentioned here https://docs.microsoft.com/en-us/java/api/overview/azure/storage-blob-readme?view=azure-java-stable.

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-storage-blob</artifactId>
    <version>12.14.1</version>
</dependency>
yugandhar02 commented 2 years ago

After adding direct dependency as suggested by @ankumalh I am getting below error. I have re-checked configuration and seems to be correct

java.lang.IllegalArgumentException: Invalid connection string.
    at com.azure.storage.common.implementation.connectionstring.StorageConnectionString.create(StorageConnectionString.java:115)
    at com.azure.storage.blob.BlobContainerClientBuilder.connectionString(BlobContainerClientBuilder.java:293)
    at sample.EncodingWithMESCustomPreset.createInputAsset(EncodingWithMESCustomPreset.java:362)
    at sample.EncodingWithMESCustomPreset.runEncodingWithMESCustomPreset(EncodingWithMESCustomPreset.java:111)
    at sample.EncodingWithMESCustomPreset.main(EncodingWithMESCustomPreset.java:70)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I can see it was authenticated correctly and transform was created successfully but was unable to upload asset because of above error

giakas commented 2 years ago

This was fixed in the latest sample. I think you are seeing issues because, you are using Track 1 AMS sdk and track 2 storage SDK and they are not compatible. see the current code, which uses both Track 2 SDKs.