My JSP code change does not take effect when deploying it in Azure App Service JBoss EAP. Is this a caching issue? And if yes how do I clear and disable the cache?

Junie Bonifacio 0 Reputation points
2024-07-12T20:57:13.7466667+00:00

I have a JSP code change that does not take effect when I deploy the war file in Azure App Service JBoss EAP 7 that uses kudu lite.

Below are my observations/investigations done:
When I deploy the war file I see that the JSP code change is deployed by checking the file contents via command line, but when hitting the application URL in the browser, the JSP code change does not take effect (even after clearing browser history/cache).

I already added set these app settings in the Azure App Service:
WEBSITE_LOCAL_CACHE_OPTION and
WEBSITE_DYNAMIC_CACHE=0

I am thinking that caching must be involved but all these settings don't work. Restarting JBoss also does not help. Restarting Azure App Service also does not help.

When I restart Azure App Service I noticed that the old JSP code changes are reverted back to the original code. Example: I would remove the war file deployed from JBoss across all 4 instances and log out of Azure. When I go and login back I would again see that the old war file without the JSP code change is deployed (even without me doing any deployment yet) which means an old copy of the JBoss EAP 7 server with the old war file in it seems to have been launched?

May I ask for more ideas on how to resolve this Azure App Service JBoss EAP caching issue?

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

1 answer

Sort by: Most helpful
  1. Sina Salam 11,991 Reputation points
    2024-07-13T20:51:51.8866667+00:00

    Hello Junie Bonifacio,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    I understand that you are experiencing issues with the deployment of your updated WAR file to Azure App Service running JBoss EAP 7, specifically with JSP changes not being reflected despite various troubleshooting steps.

    Solution

    Firstly, regarding your question:

    Is this a caching issue? And if yes how do I clear and disable the cache?

    Based on your description, it does seem likely that a caching issue is involved, especially since old JSP code is appearing after restarts and deployments. However, I will provide detail steps to clear and disable the cache later here.

    To resolve this issue, you will need to check couple of things to resolve this:

    1. Review the deployment logs in Azure App Service to see if there are any errors or warnings during the deployment process that might indicate why the changes are not being applied.
    2. Try deploying your WAR file using Azure CLI or PowerShell commands to ensure that the deployment process is not the issue. Here is an example using Azure CLI:
           az webapp deploy --resource-group <YourResourceGroup> --name <YourAppName> --src-path <path-to-your-war-file>
      
    3. Ensure that all instances of your Azure App Service are updated with the new WAR file. Sometimes, one or more instances might not be updated properly.
    4. Ensure that the WEBSITE_LOCAL_CACHE_OPTION and WEBSITE_DYNAMIC_CACHE settings are correctly applied and that there are no typos or misconfigurations. You can also try setting WEBSITE_LOCAL_CACHE_OPTION to Always or Never explicitly.
    5. Verify that there are no configuration files or startup scripts overriding your deployment settings. Sometimes, startup scripts can redeploy an old version of the WAR file.
    6. Consider using a deployment slot for staging your updates. This can help ensure that the changes are correctly applied before swapping them into production.
    7. Ensure that the WAR file you are deploying contains the updated JSP files. Sometimes, the build process might not include the latest changes. Double-check the contents of the WAR file before deploying.
    8. Use version numbers in your WAR file name to force a fresh deployment.
           az webapp deploy --resource-group <YourResourceGroup> --name <YourAppName> --src-path <path-to-your-war-file>/myapp-v1.war
      

    To Clear Cache

    JBoss EAP might be caching the JSP pages. You can try disabling the cache by setting the development attribute in the JSP configuration to true. This can usually be done in the jboss-web.xml file within your WEB-INF directory:

        <jboss-web>
           <jsp-configuration>
               <development>true</development>
           </jsp-configuration>
       </jboss-web>
    

    Secondly, manually clear any cache that JBoss might be using. This can be done by removing the contents of the standalone/tmp, standalone/data, and standalone/work directories. To do this use the Kudu console to navigate to the JBoss cache directories and clear them.

    • Access Kudu: https://<your-app-name>.scm.azurewebsites.net/DebugConsole
    • Navigate to the cache directories, typically found at D:\home\site\wwwroot\standalone\tmp, D:\home\site\wwwroot\standalone\data, and D:\home\site\wwwroot\standalone\work.
    • Delete the contents of these directories.

    Thirdly, to clear Azure App Service Cache > in the App Settings > ensure WEBSITE_LOCAL_CACHE_OPTION is set to Always or Never and WEBSITE_DYNAMIC_CACHE is set to 0. Double-check these settings in the Azure portal under your App Service's Configuration settings. Perform a full restart of the Azure App Service after clearing cache settings.

    • In Azure Portal: Navigate to your App Service > Overview > Restart.
    • In Azure CLI: az webapp restart --name <YourAppName> --resource-group <YourResourceGroup>

    To Disabling Cache

    In JBoss EAP Configuration you will have to Disable JSP Caching by update your jboss-web.xml to disable caching for JSP files.

         <jboss-web>
             <jsp-configuration>
                 <development>true</development>
             </jsp-configuration>
         </jboss-web>
    

    Then, configure standalone.xml to ensure JSP recompilation is enabled.

         <subsystem xmlns="urn:jboss:domain:web:1.5">
             <configuration>
                 <jsp-configuration development="true"/>
             </configuration>
         </subsystem>
    

    Secondly, in Azure App Service Settings you will need to Disable Local Cache by verify that WEBSITE_LOCAL_CACHE_OPTION is set to Never and WEBSITE_DYNAMIC_CACHE is set to 0. This will ensure that no local caching is happening.

    • In the Azure portal, navigate to your App Service > Configuration > Application settings.
    • Set WEBSITE_LOCAL_CACHE_OPTION to Never.
    • Set WEBSITE_DYNAMIC_CACHE to 0.

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam

    0 comments No comments

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.