Able
Able

Reputation: 57

Azure Deployment Failing with HttpServerErrorException for my Spring App

Trying to deploy my Java SpringBoot app on Azure with Azure Spring Apps. I have set config server to pick up yml file from a git repo. I don't think it locates it either.

Below are some of the logs:

2023-12-21T10:16:54.8424399Z Some error occured during deployment. Printing latest app instance log:
2023-12-21T10:16:58.1177674Z    at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:87)
2023-12-21T10:16:58.1178207Z    at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:115)
2023-12-21T10:16:58.1178674Z    at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:242)
2023-12-21T10:16:58.1179100Z    at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:229)
2023-12-21T10:16:58.1179557Z    at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:96)
2023-12-21T10:16:58.1180033Z    at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:89)
2023-12-21T10:16:58.1180539Z    at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:109)
2023-12-21T10:16:58.1181044Z    at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:94)
2023-12-21T10:16:58.1181515Z    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
2023-12-21T10:16:58.1183119Z    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
2023-12-21T10:16:58.1183593Z    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
2023-12-21T10:16:58.1184043Z    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
2023-12-21T10:16:58.1184497Z    at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
2023-12-21T10:16:58.1184943Z    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
2023-12-21T10:16:58.1185396Z    at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
2023-12-21T10:16:58.1186000Z    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
2023-12-21T10:16:58.1186476Z    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
2023-12-21T10:16:58.1186899Z    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
2023-12-21T10:16:58.1187325Z    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
2023-12-21T10:16:58.1187733Z    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:355)
2023-12-21T10:16:58.1188102Z    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
2023-12-21T10:16:58.1188461Z    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305)
2023-12-21T10:16:58.1189397Z    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294)
2023-12-21T10:16:58.1189767Z    at com.company.techservice.TechServiceApplication.main(TechServiceApplication.java:13)
2023-12-21T10:16:58.1190130Z    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-12-21T10:16:58.1190479Z    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2023-12-21T10:16:58.1190885Z    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-12-21T10:16:58.1191247Z    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2023-12-21T10:16:58.1191593Z    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
2023-12-21T10:16:58.1191944Z    at org.springframework.boot.loader.Launcher.launch(Launcher.java:95)
2023-12-21T10:16:58.1192324Z    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
2023-12-21T10:16:58.1192674Z    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
2023-12-21T10:16:58.1193651Z Caused by: **org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : "{"timestamp":"2023-12-21T10:16:54.476+00:00","status":500,"error":"Internal Server Error","path":"/tech-service/default"}"**
2023-12-21T10:16:58.1194132Z    at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:102)
2023-12-21T10:16:58.1194546Z    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:186)
2023-12-21T10:16:58.1194962Z    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:137)
2023-12-21T10:16:58.1195498Z    at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
2023-12-21T10:16:58.1195884Z    at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:915)
2023-12-21T10:16:58.1196253Z    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:864)
2023-12-21T10:16:58.1196601Z    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:764)
2023-12-21T10:16:58.1197045Z    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:646)
2023-12-21T10:16:58.1197452Z    at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.getRemoteEnvironment(ConfigServerConfigDataLoader.java:324)
2023-12-21T10:16:58.1197896Z    at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.doLoad(ConfigServerConfigDataLoader.java:121)
2023-12-21T10:16:58.1198232Z    ... 36 common frames omitted
2023-12-21T10:16:58.1199036Z 2023-12-21 10:16:54,620 [elastic-apm-init-instrumentation-shutdown-hook] INFO  co.elastic.apm.agent.bci.InstrumentationStatsLifecycleListener - Used instrumentation groups: [exception-handler, executor, executor-collection, fork-join, log-correlation, log-error, log-reformatting, logging, process, servlet-api-dispatch, servlet-service-name, servlet-version, spring-resttemplate, spring-webflux, ssl-context, urlconnection]
2023-12-21T10:16:58.1199793Z 2023-12-21 10:16:54,621 [elastic-apm-circuit-breaker] INFO  co.elastic.apm.agent.impl.circuitbreaker.CircuitBreaker - Stopping the Circuit Breaker thread.
2023-12-21T10:16:58.1200363Z 2023-12-21 10:16:54,795 [elastic-apm-init-instrumentation-shutdown-hook] INFO  co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to STOPPED state
2023-12-21T10:16:58.1200934Z 2023-12-21 10:16:54,795 [elastic-apm-init-instrumentation-shutdown-hook] INFO  co.elastic.apm.agent.report.ApmServerReporter - dropped events because of full queue: 0
2023-12-21T10:16:58.1201514Z 2023-12-21 10:16:54,804 [elastic-apm-init-instrumentation-shutdown-hook] INFO  co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Reported events: 25
2023-12-21T10:16:58.1202066Z 2023-12-21 10:16:54,804 [elastic-apm-init-instrumentation-shutdown-hook] INFO  co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Dropped events: 0
2023-12-21T10:16:58.1202384Z 
2023-12-21T10:16:58.1203266Z ##[error]Deployment Failed with Error: {}
2023-12-21T10:16:58.1208338Z ##[error]Operation failed: 400 Bad Request

I have tried upgrading and downgrading spring cloud version (using spring-cloud-verion 2022.0.3). I have tried switch config repo branches. I still think I'm missing something.

Upvotes: 0

Views: 114

Answers (1)

Suresh Chikkam
Suresh Chikkam

Reputation: 3332

Java applications are generally the most difficult ones to launch on Azure, depending on the packages or other factors.

  • Please check the below configuration of my pom.xml file:
<plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-spring-apps-maven-plugin</artifactId>
        <version>1.17.0</version>
        <configuration>
                    
            <subscriptionId>Azure_SUbscription_id</subscriptionId>
            <resourceGroup>Resource_group_name</resourceGroup>
            <clusterName>kpspringapp</clusterName>
            <appName>springboot-crud</appName>
            <isPublic>false</isPublic>
            <deployment>
                  <cpu>1</cpu>
                  <memoryInGB>1</memoryInGB>
                  <instanceCount>1</instanceCount>
                  <runtimeVersion>Java 11</runtimeVersion>
                  <resources>
                      <resource>
                          <filtering/>
                          <mergeId/>
                          <targetPath/>
                        <directory>${project.basedir}/target</directory>
                          <includes>
                               <include>*.jar</include>
                          </includes>
                       </resource>
                   </resources>
              </deployment>
         </configuration>
    </plugin>

Go to the root folder of the spring-boot app and run the below commands.

  • mvn clean install

enter image description here

Deploying the above app to Azure spring apps:

enter image description here

enter image description here

Upvotes: 0

Related Questions