[App service] How to change tomcat apache server files (context.xml) after deploying my web app

Amira SFARI 1 Reputation point
2021-07-13T15:36:37.517+00:00

for my app deployment it's required to make some changes to context.xml after deploying the app. I'm aware that Azure App Service is a paas and there's no way to make changes to system files and any change will not be persistent after reboot but I have to edit the context.xml file to this content so my app can recognise the database:

<?xml version='1.0' encoding='utf-8'?>
<Context>
<WatchedResource> WEB-INF/web.xml </WatchedResource>
<Resource name="jdbc/testing" auth="Container" type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
username="teur@testing "
password="xxx" driverClassName="com.mysql.jdbc.Driver"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" url="jdbc:mysql://testing.mysql.database.azure.com:3306/edmydb?useUnicode=true&characterEncoding=UTF-8"/>
</Context>

any suggestion?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,770 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 28,106 Reputation points Microsoft Employee
    2021-07-15T23:26:44.493+00:00

    Hi @Amira SFARI ,

    Check out Application-level data sources under Configure data sources. You can add context.xml to META-INF/ directory and use those types in the web.xml file.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.