azure-maven-plugins
azure-maven-plugins copied to clipboard
azure-spring-cloud-maven-plugin Unexpected Service(XXX) in subscription(YYY) is not found
Plugin name and version
com.microsoft.azure:azure-spring-cloud-maven-plugin:1.9.0
Plugin configuration in your pom.xml
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-cloud-maven-plugin</artifactId>
<version>1.9.0</version>
<!-- https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Spring-Cloud -->
<configuration>
<runtimeVersion>Java_11</runtimeVersion>
<allowTelemetry>false</allowTelemetry>
<appName>${azure.appName}</appName>
<clusterName>${azure.env}-${cluster.name}</clusterName>
<!-- https://github.com/microsoft/azure-maven-plugins/wiki/Authentication#service-principles-in-plugin-configuration -->
<auth>
<serverId>azure-auth</serverId>
</auth>
<public>true</public>
<isPublic>true</isPublic>
<subscriptionId>YYY</subscriptionId>
<!-- ??? -->
<advancedOptions>true</advancedOptions>
<!-- https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Spring-Cloud%3A-Configuration-Details -->
<deployment>
<environment>
<SPRING_PROFILES_ACTIVE>${azure.spring.profiles.active}</SPRING_PROFILES_ACTIVE>
</environment>
</deployment>
<!-- About the lack of skip option -->
<!-- https://github.com/microsoft/azure-maven-plugins/issues/1936 -->
</configuration>
<executions>
<!-- mvn azure-spring-cloud:deploy -Pazure,dev,deploySpringCloud -->
<execution>
<id>deployWebApp</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
Expected behavior
Proper deployement of the app to Azure Spring Cloud
Actual behavior
The plugin fails wioth:
Caused by: com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException: Service(XXX) in subscription(YYY) is not found
at com.microsoft.azure.toolkit.lib.springcloud.task.DeploySpringCloudAppTask.lambda$initTasks$0 (DeploySpringCloudAppTask.java:49)
at java.util.Optional.orElseThrow (Optional.java:403)
at com.microsoft.azure.toolkit.lib.springcloud.task.DeploySpringCloudAppTask.initTasks (DeploySpringCloudAppTask.java:48)
at com.microsoft.azure.toolkit.lib.springcloud.task.DeploySpringCloudAppTask.<init> (DeploySpringCloudAppTask.java:38)
at com.microsoft.azure.maven.springcloud.DeployMojo.doExecute (DeployMojo.java:73)
at com.microsoft.azure.maven.AbstractAzureMojo.execute (AbstractAzureMojo.java:525)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
Steps to reproduce the problem
Unknown.
I checked multiple times in Azure Portal: we do have an 'Azure Spring Cloud' in given subscription. As we do not configure a resourceGroup in the plugin, I hope it is properly guessed, as it is not printed in the logs.
final SpringCloudDeploymentConfig deploymentConfig = config.getDeployment();
final String clusterName = config.getClusterName();
final String appName = config.getAppName();
final String resourceGroup = config.getResourceGroup();
final SpringCloudCluster cluster = Azure.az(AzureSpringCloud.class).clusters(config.getSubscriptionId()).get(clusterName, resourceGroup);
Optional.ofNullable(cluster).orElseThrow(() -> new AzureToolkitRuntimeException(
String.format("Service(%s) in subscription(%s) is not found", clusterName, config.getSubscriptionId())));
Thanks for reporting, but we failed to reproduce it. We'll look through the code to see if we can find any clues.
Hi, @blacelle, we couldn't reproduce this issue locally, but we found some clues from the code and fixed it.
It will list all services in the subscription and search one by name
if resource group is not provided. (So, it should be slower if resource group name is not provided.)
but the implementation of listing all service in the subscription
has a bug: it will return the old list (which is empty in default) if there is already another thread listing (loading resources from Azure).
We fixed the problem. Can you try it on endgame-202204.deprecation
branch? The updated version should be 1.10.0
if resource group is not provided
How can I specify the resourceGroup in the maven plugin configuration?
@blacelle my bad, specifying resourceGroup
is not supported yet. I'll add this in future.
I still have the same issue:
Caused by: com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException: Azure Spring Apps(dev-kubernetes) is not found in subscription(f736e4be-d67b-44ea-b2cf-4fd5d2992662).
at com.microsoft.azure.toolkit.lib.springcloud.task.DeploySpringCloudAppTask.lambda$initTasks$0 (DeploySpringCloudAppTask.java:52)
at java.util.Optional.orElseThrow (Optional.java:403)
at com.microsoft.azure.toolkit.lib.springcloud.task.DeploySpringCloudAppTask.initTasks (DeploySpringCloudAppTask.java:51)
at com.microsoft.azure.toolkit.lib.springcloud.task.DeploySpringCloudAppTask.<init> (DeploySpringCloudAppTask.java:40)
at com.microsoft.azure.maven.springcloud.DeployMojo.doExecute (DeployMojo.java:77)

@blacelle can you try the following steps to confirm if the expected service can be listed?
- remove the
<configuration>...</configuration>
node (including its offspring nodes) from
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-cloud-maven-plugin</artifactId>
<version>1.10.0</version>
<!-- https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Spring-Cloud -->
<configuration> <!--remove this node-->
...
</configuration>
<plugin>
- run
mvn azure-spring-cloud:config
, - select the expected subscription when asked
- and then you will be asked to select an
Azure Spring Cloud service
as shown in the screenshot below, please check if the expected spring cloud service is in the list?
It gives:
[ERROR] Failed to execute goal com.microsoft.azure:azure-spring-cloud-maven-plugin:1.9.0:config (default-cli) on project gateway: Error creating extended parser class: Could not determine whether class 'org.jtwig.parser.parboiled.base.BooleanParser$$parboiled' has already been loaded: Unable to make protected final java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @20f6f88c
mvn -version
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /usr/local/Cellar/maven/3.8.3/libexec
Java version: 17.0.2, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "12.2.1", arch: "x86_64", family: "mac"