0
点赞
收藏
分享

微信扫一扫

【应用服务 App Service】App Service 中部署Java项目,查看Tomcat配置及上传自定义版本

前端王祖蓝 2022-09-02 阅读 51

当在Azure 中部署Java应用时候,通常会遇见下列的问题:

  1. 如何部署一个Java的项目呢?
  2. 部署成功后,怎么来查看Tomcat的服务器信息呢?
  3. 如果Azure提供的默认Tomcat版本的配置跟应用所需要的版本不一致时,如何来自定义Tomcat的版本呢?

适用环境

App Service For Windows

解决方案

对以上的三个问题,可以针对性的参考如下三个文档:

如何在 Web 应用上部署 Spring Boot 项目

​​https://docs.azure.cn/zh-cn/articles/azure-operations-guide/app-service-web/aog-app-service-web-howto-deploy-java-spring-boot-project​​

如何通过 Kudu 查看/修改 Java Tomcat 服务端的配置文件

​​https://docs.azure.cn/zh-cn/articles/azure-operations-guide/app-service-web/aog-app-service-web-howto-modify-tomcat-server-profile-with-kudu​​

如何为 Web 应用配置自定义 Tomcat 环境

​​https://docs.azure.cn/zh-cn/articles/azure-operations-guide/app-service-web/aog-app-service-web-howto-configure-custom-tomcat-environment​​

 

注:在自定义Tomcat的环境时候,需要特别注意对conf/server.xml的4处修改(端口,连接,IP及路径)

 

附件一:在使用Azure 默认的Tomcat版本启动Jar包时的Web.config例子如:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe" stdoutLogEnabled ="true" arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\springbootsample-1.0.0.jar"">
</httpPlatform>
</system.webServer>
</configuration>

附件二:自定义Tomcat版本启动Jar包时的Web.config例子如:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%HOME%\site\wwwroot\bin\tomcat\bin\startup.bat" arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\springbootsample-1.0.0.jar"">
<environmentVariables>
<environmentVariable name="CATALINA_OPTS" value="-Dport.http=%HTTP_PLATFORM_PORT%" />
<environmentVariable name="CATALINA_HOME" value="%HOME%\site\wwwroot\bin\tomcat" />
<environmentVariable name="JRE_HOME" value="D:\home\site\wwwroot\bin\java\jdk1.6.0_45\jre6" />
<environmentVariable name="JAVA_OPTS" value="-Djava.net.preferIPv4Stack=true" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>

 

 

 

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!



举报

相关推荐

0 条评论