Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D7051200C5D for ; Fri, 7 Apr 2017 10:09:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D3C3C160B93; Fri, 7 Apr 2017 08:09:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 25EFF160B97 for ; Fri, 7 Apr 2017 10:09:15 +0200 (CEST) Received: (qmail 87370 invoked by uid 500); 7 Apr 2017 08:09:12 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 87359 invoked by uid 99); 7 Apr 2017 08:09:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Apr 2017 08:09:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4344CC0254 for ; Fri, 7 Apr 2017 08:09:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.397 X-Spam-Level: X-Spam-Status: No, score=-0.397 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Ld7f50mFSCWn for ; Fri, 7 Apr 2017 08:09:10 +0000 (UTC) Received: from mail-wr0-f180.google.com (mail-wr0-f180.google.com [209.85.128.180]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 1145A5FD6D for ; Fri, 7 Apr 2017 08:09:10 +0000 (UTC) Received: by mail-wr0-f180.google.com with SMTP id c55so22145490wrc.3 for ; Fri, 07 Apr 2017 01:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=xUnQYnoPtUP/iQFRAZM6XkQ42O4NVp6cnWLCVF3sblg=; b=l534QvHPgGR0YCUV59bk6Eqz30NQG6/HMxKTk1771DANiuCkE8QjGbZwISBXFRPD2I tkCkwRiK8uRWO/hBkyojOqa8eG+TVjwcVx4zzDkCbEODQwn6buwvx37ykSCBT3mSHyQ5 SM36ljBXO7qo5KIWFCv9gRpiOpzeLbty+ZWOZisTny//UEAUMhg25B3AeCBU0Eq9XuEJ aKpvmvNafIqH4CHDI3xZMNz0CzxIPYb6hpIFvvxHnaHKmhnubaJaTaVcq3WNFcObWtci dNq/LTVkE90Hphi3Wq6zfbdfBBE5CkqwHXJz9Yu5Umr/EPIUbzS3V7ZespE4oqlcOl5/ aN5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xUnQYnoPtUP/iQFRAZM6XkQ42O4NVp6cnWLCVF3sblg=; b=YVTYtD+x/bIvuVELJefk/wdCk1ZlgRK4t+Ll5HMdCwmQPOonaJYS5Celz+05Xldrwy LC0HFt2jU4Or1mg0gyfm+7oRklCXDvm7J2KwHxW1xhrc7zkECCFdEDpqWOJnjVPXrL4D KDRONkk1Y2oI/Gqj+Qi5RH6npx5LNGyLdSsjqDCUXp3LJ1YPvJsFXsSIa/NFp7NEQYA+ 99yv2yvEi23HEvwpMkiufDC85Wnn6jifOCT5iYuN6eXMcc6qfw+Fo7DzN9U8gtsAHt42 brYPLiyIjzO4YMOKj/r/CgZQLyE2CeogryXR4rcvFWicHryznXYts/Awfc0oNgZt+ujA 32Mw== X-Gm-Message-State: AFeK/H3gPCbyiy4VrmvpJ1Uf1rWkT/7ytyqi44t9fG36RgLWr0SQMUwL 0QfJCt8uhELhSf0WQwQNacntAYM2lA== X-Received: by 10.28.65.196 with SMTP id o187mr27563230wma.9.1491552549336; Fri, 07 Apr 2017 01:09:09 -0700 (PDT) MIME-Version: 1.0 From: Bruce Huang Date: Fri, 07 Apr 2017 08:08:58 +0000 Message-ID: Subject: Get fail response by using the Tomcat manager command to deploy a war To: Tomcat Users List Content-Type: multipart/alternative; boundary=001a1148ea00de03ba054c8f23fd archived-at: Fri, 07 Apr 2017 08:09:17 -0000 --001a1148ea00de03ba054c8f23fd Content-Type: text/plain; charset=UTF-8 Hi all, I want to use the tomcat supported manager command to deploy a war file. The Tomcat server is Tomcat v8.0.23. The application is sure to be deployed and started successfully, I, however, got the failed message of the response as below *FAIL - Deployed application at context path /test but context failed to start* The way I used is the HttpURLConnection in Java to PUT a file by an HTTP request as below code public void execute(ResponseHandler handler) throws IOException { String deployURL = "http://localhost/manager/text/deploy?update=true&path=/test" final HttpURLConnection hconn = (HttpURLConnection) (new URL(deployURL)).openConnection(); try (FileInputStream fsInput = new FileInputStream(deployedPackage)) { final long contentLength = fsInput.getChannel().size(); hconn.setAllowUserInteraction(false); hconn.setDoInput(true); hconn.setUseCaches(false); hconn.setDoOutput(true); hconn.setRequestMethod("PUT"); hconn.setRequestProperty("Content-Type", "application/octet-stream"); hconn.setRequestProperty("Content-Length", "" + contentLength); hconn.setFixedLengthStreamingMode(contentLength); hconn.setRequestProperty("User-Agent", "Catalina-Ant-Task/1.0"); // Set up an authorization header with our credentials final String input = this.username + ":" + this.password; final String output = Base64.getEncoder().encodeToString(input.getBytes(StandardCharsets.ISO_8859_1)); hconn.setRequestProperty("Authorization", "Basic " + output); // Establish the connection with the server hconn.connect(); try (BufferedInputStream istream = new BufferedInputStream(fsInput, 1024); BufferedOutputStream ostream = new BufferedOutputStream(hconn.getOutputStream(), 1024)) { final byte buffer[] = new byte[1024]; while (true) { int n = istream.read(buffer); if (n < 0) { break; } ostream.write(buffer, 0, n); } } } String response = new String(); // Process the response message try (InputStreamReader reader = new InputStreamReader(hconn.getInputStream(), "utf-8")) { final StringBuilder buff = new StringBuilder(); while (true) { int ch = reader.read(); if (ch < 0) { break; } else { buff.append((char) ch); } } handler.handle(buff.toString()); } hconn.disconnect();} The target URL is *http://localhost/manager/text/deploy?update=true&path=/test * for deploying a war file to a context path "test". And the *deployedPackage* is a File with the size amount 130 MB. Is there anything I miss to set up or do it in the wrong way? Thanks --001a1148ea00de03ba054c8f23fd--