2017-10-09 10 views
0

http rest appi를 통해 AS wildfly에서 웹 응용 프로그램을 배포 (재배포)했습니다. 기능은 작동하지만 문제가 있습니다. 그래서 기능 :web-app를 업로드하고 배포해야하는 기능이 올바르게 작동하지 않습니다.

def upload_and_deploy(server, app): 
    try: 
     pass 
     files = {'file': open(distr_path + '/app-01.001.02-028.war', 'rb')} 
     response = requests.post('http://' + server + ':9990/management/add-content', files=files, auth=HTTPDigestAuth('login', 'password')).text 
     response_converted_to_json = json.loads(response) 
     bytes_value_from_response = response_converted_to_json["result"]["BYTES_VALUE"] 
     json_start = '{"content":[{"hash": {"BYTES_VALUE" : "' 
     json_end = '"}}], "address": [{"deployment":"'+ app + '"}], "operation":"add", "enabled":"true"}' 
     full_json_for_deploy_request = json_start+bytes_value_from_response+json_end 
     print '>>>>>>', full_json_for_deploy_request 
     response = requests.post('http://' + server + ':9990/management', auth=HTTPDigestAuth('login', 'password'), data= (full_json_for_deploy_request), headers=headers) 
     print "Start", app, "code -", response.status_code 

    except requests.exceptions.ConnectionError: 
     print 'Server - %s not run' % server 

결과가 좋아 보인다 : 로그 AS

>>>>>> {"content":[{"hash": {"BYTES_VALUE" : "t3W62oVUihsqyINy9rRG/T3DuI4="}}], "address": [{"deployment":"app-name"}], "operation":"add", "enabled":"true"} 
Start app-name code - 200 

전형적인하지 보이지만, 오류없이이 :

2017-10-09 10:07:07,688 INFO [org.jboss.as.repository] (XNIO-1 task-9) WFLYDR0001: Content added at location /opt/platform/wildfly-9.0.2.Final/standalone/data/content/b7/75bada85548a1b2ac88372f6b446fd3dc3b88e/content 
2017-10-09 10:07:07,704 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "app-name" (runtime-name: "app-name") 
2017-10-09 10:07:07,983 INFO [org.jboss.as.server] (XNIO-1 task-2) WFLYSRV0010: Deployed "app-name" (runtime-name : "app-name") 

그래서 응용 프로그램 실행,하지만 작동하지 않습니다. 누군가 나에게 큐를 줄 수 있습니까? 그게 뭐가 잘못 되었나요?

답변

1

적절한 처리가 이루어 지도록 배포 이름은 유효한 아카이브 확장자로 끝나야합니다. 귀하의 경우에는 .war으로 끝나야합니다.

json_end은 다음과 유사해야합니다.

json_end = '"}}], "address": [{"deployment":"'+ app + '.war"}],"operation":"add", "enabled":"true"}'