Can I deploy a jhipster 5.0.0-beta.0 application in azure?

主宰稳场 提交于 2020-01-16 04:21:06

问题


I have an application made with jhipster version 5.0.0-beta.0 and I try to put it in Azure as a web app and did not start

I tried to put the war with FTP. The war is named ROOT, the azure automatically extracts it but the application did not start. On local same war, I start it with the command: java -jar root.war --server.port=9402 and it started normally. On the server, I have error 404 and in the Azure application logs, I have an HTML error (HTTP Error 404.0). I tried to generate a new application like the core of this one with the same azure version (5.0.0-beta.0 ):

I put it on the server with the connection at the same SQL server where I have this generated tables: jhi_autority,jhy_persistent_autit_event,jhi_persistent_audit_event_data,jhi_redirect_token,jhi_user,jhy_authority, jhy_user_authority. I have emptied tables except for jhy_authority, jhi_user, and jhy_user_authority. Locally same war it starts (java -jar root.war --server.port=9402) and run and all is ok, on the Azure server I can't log in on the requests: /api/authentication and /api/logout request I get a 404 error.

On Azure web app, I have this configuration: - stack: java - java version: 1.8(auto-update) - java container: tomcat - java container version: 8.5(auto-update) - platform: 32bit - managed pipeline version: integrated - http version: 1.1.

I want to make this app run normally on Azure too. Other applications that I tried to upload on this web app generated with jhipster 5.8.2 and with the same database run ok. I don't want to update the jhipster on this application because I tried that but manually I think it takes weeks.

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "ro.netgas.admodunet",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "5.0.0-beta.0",
    "baseName": "admodunet",
    "reactive": false,
    "packageName": "ro.netgas.admodunet",
    "packageFolder": "ro/netgas/admodunet",
    "serverPort": "8080",
    "authenticationType": "session",
    "cacheProvider": "ehcache",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "mssql",
    "prodDatabaseType": "mssql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "rememberMeKey": "384b43c544db6d26dae8f8b07d54490cd6eff9aa",
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "ro"
    ]
  }
}

回答1:


If you can run your root.war successfully via java -jar root.war --server.port=9402 on local, you can follow my steps below to deploy the same file root.war on Azure.

Here is my steps to deploy a jar file which I followed the current JHipster documents to make. It works for me.

  1. Upload your root.war file to the path wwwroot on Azure WebApp via FTP or other ways.
  2. Add a file named web.config to the same path wwwroot on Azure WebApp via FTP or other ways, the web.config content is as below.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <handlers>
                <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
            </handlers>
            <httpPlatform processPath="%ProgramW6432%\Java\jdk1.8.0_60\bin\java.exe" arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\root.war&quot;" stdoutLogEnabled="true" startupRetryCount='10'>
            </httpPlatform>
        </system.webServer>
    </configuration>
    

Then, you need to restart your WebApp and try to browser it. And you will see some log files named like httpplatform-stdout_xxxxx_2019xxxxxxx.log and the content likes as below which means to works.

----------------------------------------------------------
    Application 'myapplication' is running! Access URLs:
    Local:      http://localhost:28747/
    External:   http://100.75.228.104:28747/
    Profile(s):     [prod]
----------------------------------------------------------

Note: the port 28747 is random assigned by Azure WebApp, which value is from the environment %HTTP_PLATFORM_PORT%.



来源:https://stackoverflow.com/questions/56948813/can-i-deploy-a-jhipster-5-0-0-beta-0-application-in-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!