You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/tutorial-java-tomcat-mysql-app.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,8 +188,7 @@ In this step, you use the SSH connection to the app container to verify the JNDI
188
188
:::row-end:::
189
189
:::row:::
190
190
:::column span="2":::
191
-
**Step 2:** In the SSH terminal:
192
-
1. Run `cat /usr/local/tomcat/conf/context.xml`. You should see that a JNDI resource called `jdbc/AZURE_MYSQL_CONNECTIONSTRING_DS` was added. You'll use this data source later.
191
+
**Step 2:** In the SSH terminal, run `cat /usr/local/tomcat/conf/context.xml`. You should see that a JNDI resource called `jdbc/AZURE_MYSQL_CONNECTIONSTRING_DS` was added. You'll use this data source later.
193
192
:::column-end:::
194
193
:::column:::
195
194
:::image type="content" source="./media/tutorial-java-tomcat-mysql-app/azure-portal-check-config-in-ssh-2.png" alt-text="A screenshot showing the commands to run in the SSH shell and their output." lightbox="./media/tutorial-java-tomcat-mysql-app/azure-portal-check-config-in-ssh-2.png":::
@@ -200,6 +199,8 @@ In this step, you use the SSH connection to the app container to verify the JNDI
200
199
> Only changes to files in `/home` can persist beyond app restarts. For example, if you edit `/usr/local/tomcat/conf/server.xml`, the changes won't persist beyond an app restart.
201
200
>
202
201
202
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
203
+
203
204
## 5. Deploy sample code
204
205
205
206
In this step, you configure GitHub deployment using GitHub Actions. It's just one of many ways to deploy to App Service, but also a great way to have continuous integration in your deployment process. By default, every `git push` to your GitHub repository kicks off the build and deploy action.
@@ -305,6 +306,8 @@ Having issues? Check the [Troubleshooting section](#troubleshooting).
305
306
:::column-end:::
306
307
:::row-end:::
307
308
309
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
310
+
308
311
## 7. Stream diagnostic logs
309
312
310
313
Azure App Service captures all messages output to the console to help you diagnose issues with your application. The sample application includes standard Log4j logging statements to demonstrate this capability, as shown in the following snippet:
@@ -333,6 +336,8 @@ Azure App Service captures all messages output to the console to help you diagno
333
336
334
337
Learn more about logging in Java apps in the series on [Enable Azure Monitor OpenTelemetry for .NET, Node.js, Python and Java applications](../azure-monitor/app/opentelemetry-enable.md?tabs=java).
335
338
339
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
340
+
336
341
## 8. Clean up resources
337
342
338
343
When you're finished, you can delete all of the resources from your Azure subscription by deleting the resource group.
@@ -417,6 +422,8 @@ The dev container already has the [Azure Developer CLI](/azure/developer/azure-d
417
422
- **Log Analytics workspace**: Acts as the target container for your app to ship its logs, where you can also query the logs.
418
423
- **Key vault**: Used to keep your database password the same when you redeploy with AZD.
419
424
425
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
426
+
420
427
## 3. Verify connection strings
421
428
422
429
The AZD template you use generated the connectivity variables for you already as [app settings](configure-common.md#configure-app-settings) and outputs the them to the terminal for your convenience. App settings are one way to keep connection secrets out of your code repository.
@@ -436,6 +443,8 @@ The AZD template you use generated the connectivity variables for you already as
436
443
437
444
If you add an app setting that contains a valid Oracle, SQL Server, PostgreSQL, or MySQL connection string, App Service adds it as a Java Naming and Directory Interface (JNDI) data source in the Tomcat server's *context.xml* file.
438
445
446
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
447
+
439
448
## 4. Confirm JNDI data source
440
449
441
450
In this step, you use the SSH connection to the app container to verify the JNDI data sourcein the Tomcat server. In the process, you learn how to access the SSH shell for the Tomcat container.
@@ -454,6 +463,8 @@ In this step, you use the SSH connection to the app container to verify the JNDI
454
463
> Only changes to files in `/home` can persist beyond app restarts. For example, if you edit `/usr/local/tomcat/conf/server.xml`, the changes won't persist beyond an app restart.
455
464
>
456
465
466
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
467
+
457
468
## 5. Modify sample code and redeploy
458
469
459
470
1. Back in the GitHub codespace of your sample fork, from the explorer, open *src/main/java/com/microsoft/azure/appservice/examples/tomcatmysql/ContextListener.java*. When the application starts, this class loads the database settings in*src/main/resources/META-INF/persistence.xml*.
@@ -479,6 +490,8 @@ In this step, you use the SSH connection to the app container to verify the JNDI
479
490
> [!TIP]
480
491
> You can also just use `azd up` always, which does both `azd provision` and `azd deploy`.
481
492
493
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
494
+
482
495
## 6. Browse to the app
483
496
484
497
1. In the AZD output, find the URL of your app and navigate to it in the browser. The URL looks like this in the AZD output:
@@ -496,6 +509,8 @@ In this step, you use the SSH connection to the app container to verify the JNDI
496
509
497
510
Congratulations, you're running a web app in Azure App Service, with secure connectivity to Azure Database for MySQL.
498
511
512
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
513
+
499
514
## 7. Stream diagnostic logs
500
515
501
516
Azure App Service can capture console logs to help you diagnose issues with your application. For convenience, the AZD template already [enabled logging to the local file system](troubleshoot-diagnostic-logs.md#enable-application-logging-linuxcontainer) and is [shipping the logs to a Log Analytics workspace](troubleshoot-diagnostic-logs.md#send-logs-to-azure-monitor).
@@ -512,6 +527,8 @@ Stream App Service logs at: https://portal.azure.com/#@/resource/subscriptions/&
512
527
513
528
Learn more about logging in Java apps in the series on [Enable Azure Monitor OpenTelemetry for .NET, Node.js, Python and Java applications](../azure-monitor/app/opentelemetry-enable.md?tabs=java).
514
529
530
+
Having issues? Check the [Troubleshooting section](#troubleshooting).
531
+
515
532
## 8. Clean up resources
516
533
517
534
To delete all Azure resources in the current deployment environment, run `azd down` and follow the prompts.
0 commit comments