Skip to content

Commit b3b4b1f

Browse files
cephalinCephas Lin
authored andcommitted
bump to Tomcat 10.1 and other staged review changes
1 parent be5dd86 commit b3b4b1f

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed
5.4 KB
Loading

articles/app-service/tutorial-java-tomcat-mysql-app.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ For your convenience, the [sample repository](https://github.com/Azure-Samples/m
8282
:::column-end:::
8383
:::row-end:::
8484

85+
Having issues? Check the [Troubleshooting section](#troubleshooting).
86+
8587
::: zone pivot="azure-portal"
8688

8789
## 2. Create App Service and MySQL
@@ -114,7 +116,7 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
114116
1. *Region*: Any Azure region near you.
115117
1. *Name*: **msdocs-tomcat-mysql-XYZ** where *XYZ* is any three random characters. This name must be unique across Azure.
116118
1. *Runtime stack*: **Java 17**.
117-
1. *Java web server stack*: **Apache Tomcat 10.0**.
119+
1. *Java web server stack*: **Apache Tomcat 10.1**.
118120
1. **MySQL - Flexible Server** is selected for you by default as the database engine. If not, select it. Azure Database for MySQL is a fully managed MySQL database as a service on Azure, compatible with the latest community editions.
119121
1. *Hosting plan*: **Basic**. When you're ready, you can [scale up](manage-scale-up.md) to a production pricing tier later.
120122
1. Select **Review + create**.
@@ -139,6 +141,8 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
139141
:::column-end:::
140142
:::row-end:::
141143

144+
Having issues? Check the [Troubleshooting section](#troubleshooting).
145+
142146
## 3. Verify connection settings
143147

144148
The creation wizard generated the connectivity string for you already as [app settings](configure-common.md#configure-app-settings). In this step, you learn where to find the app settings, and how you can create your own.
@@ -368,14 +372,14 @@ When you're finished, you can delete all of the resources from your Azure subscr
368372

369373
In this step, you create the Azure resources and deploy a sample app to App Service on Linux. The steps used in this tutorial create a set of secure-by-default resources that include App Service and Azure Database for MySQL.
370374

371-
1. If you haven't already, clone the sample repository's `starter-no-infra` branch in a local terminal.
375+
1. In the GitHub codspace of your sample fork, get the remote `starter-no-infra` branch by running the following code in the terminal.
372376

373377
```bash
374-
git checkout starter-no-infra
375-
cd msdocs-tomcat-mysql-sample-app
378+
git fetch upstream
379+
git checkout -b starter-no-infra upstream/starter-no-infra
376380
```
377381

378-
This cloned branch is your starting point. It contains a simple data-drive Tomcat application.
382+
This branch is your starting point. It contains a simple data-drive Tomcat application.
379383

380384
1. From the repository root, run `azd init`.
381385

@@ -403,7 +407,7 @@ In this step, you create the Azure resources and deploy a sample app to App Serv
403407
azd up
404408
```
405409

406-
The `azd up` command takes about 15 minutes to complete (the database and the cache take the most time). It also compiles and deploys your application code, but you'll modify your code later to work with App Service. While it's running, the command provides messages about the provisioning and deployment process, including a link to the deployment in Azure. When it finishes, the command also displays a link to the deploy application.
410+
The `azd up` command takes about 15 minutes to complete (the Redis cache take the most time). It also compiles and deploys your application code, but you'll modify your code later to work with App Service. While it's running, the command provides messages about the provisioning and deployment process, including a link to the deployment in Azure. When it finishes, the command also displays a link to the deploy application.
407411

408412
This azd template contains files (*azure.yaml* and the *infra* directory) that generate a secure-by-default architecture with the following Azure resources:
409413

@@ -456,7 +460,7 @@ In this step, you use the SSH connection to the app container to verify the JNDI
456460
457461
## 5. Modify sample code and redeploy
458462
459-
1. Back in the GitHub codespace of your sample fork, open *src/main/java/com/microsoft/azure/appservice/examples/tomcatmysql/ContextListener.java* in the explorer. When the application starts, this class loads the database settings in *src/main/resources/META-INF/persistence.xml*.
463+
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*.
460464
461465
1. In the `contextIntialized()` method, find the commented code (lines 29-33) and uncomment it.
462466
@@ -470,12 +474,15 @@ In this step, you use the SSH connection to the app container to verify the JNDI
470474
471475
This code checks to see if the `AZURE_MYSQL_CONNECTIONSTRING` app setting exists, and changes the data source to `java:comp/env/jdbc/AZURE_MYSQL_CONNECTIONSTRING_DS`, which is the data source you found earlier in *context.xml* in the SSH shell.
472476
473-
1. In the terminal, run `azd deploy`.
477+
1. Back in the codespace terminal, run `azd deploy`.
474478
475479
```bash
476480
azd deploy
477481
```
478482
483+
> [!TIP]
484+
> You can also just use `azd up` always, which does both `azd provision` and `azd deploy`.
485+
479486
## 6. Browse to the app
480487
481488
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:
@@ -521,10 +528,18 @@ azd down
521528

522529
## Troubleshooting
523530

531+
- [I see many \<Class> scanned from multiple locations warnings with mvn jetty:run](#i-see-many-class-scanned-from-multiple-locations-warnings-with-mvn-jettyrun)
532+
- [The deployed sample app doesn't show the tasks list app](#the-deployed-sample-app-doesnt-show-the-tasks-list-app)
533+
- [The portal deployment view for Azure Database for MySQL Flexible Server shows a Conflict status](#the-portal-deployment-view-for-azure-database-for-mysql-flexible-server-shows-a-conflict-status)
534+
524535
#### I see many \<Class> scanned from multiple locations warnings with mvn jetty:run
525536
526537
You can ignore the warnings. The Maven Jetty plugin shows the warnings because the app's *pom.xml* contains the dependency for `jakarta.servlet.jsp.jstl`, which the Jetty already provides out of the box. You need the dependency for Tomcat.
527538

539+
#### The deployed sample app doesn't show the tasks list app
540+
541+
If you see a `Hey, Java developers!` page instead of the tasks list app, it's most likely still loading the updated container from your most recent code deployment. Wait a few minutes and try again.
542+
528543
#### The portal deployment view for Azure Database for MySQL Flexible Server shows a Conflict status
529544
530545
Depending on your subscription and the region you select, you may see the deployment status for Azure Database for MySQL Flexible Server to be `Conflict`, with the following message in Operation details:

0 commit comments

Comments
 (0)