Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 502代理错误:代理服务器从上游服务器接收到无效响应_Java_Spring_Maven_Tomcat_Proxy - Fatal编程技术网

Java 502代理错误:代理服务器从上游服务器接收到无效响应

Java 502代理错误:代理服务器从上游服务器接收到无效响应,java,spring,maven,tomcat,proxy,Java,Spring,Maven,Tomcat,Proxy,我正在尝试让我的第一个web应用程序正常工作,但在尝试部署到服务器时遇到了一些问题。我做了一些研究,但我似乎找不到解决方案如何适用于我。当我在本地tomcat服务器上运行时,我的应用程序运行良好,但当我尝试部署到Elastic Beanstalk时,我收到一个this proxy错误。下面是所有的细节 pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XM

我正在尝试让我的第一个web应用程序正常工作,但在尝试部署到服务器时遇到了一些问题。我做了一些研究,但我似乎找不到解决方案如何适用于我。当我在本地tomcat服务器上运行时,我的应用程序运行良好,但当我尝试部署到Elastic Beanstalk时,我收到一个this proxy错误。下面是所有的细节

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>FirstSpringMVCProject</groupId>
  <artifactId>FirstSpringMVCProject</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.41</version>
    </dependency>
  </dependencies>
</project>
我假设我的Java其余部分是无关的,在本地运行良好。我得到的唯一错误是

INFO: Illegal access: this web application instance has been stopped already.  Could not load .  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
Mar 23, 2017 10:27:21 AM org.apache.catalina.loader.WebappClassLoader findResourceInternal
但该应用程序似乎仍然运行良好

这就是我尝试访问应用程序时得到的所有信息

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: Error reading from remote server

另外(最后100行)

配置超时,错误很可能是由超时错误引起的。因此,将超时值配置为一个高值。我如何做到这一点?@BenArnao在您的文件httpd.conf中添加此行timeout 400
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
ol {
    padding: 12px;
    background-color: #eee;
    display: inline-block;
    list-style-type: none;
    text-align: center;
}
body {
    font-family: Courier;
    text-align: center;
}
button {
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 12px 25px;
    text-align: center;
    font-size: 18px;
    font-family: Courier;
    white-space: normal;
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Basketball Player Rater</title>
</head>
<h2>Basketball Player Rater</h2>
<body>
<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
     url="jdbc:mysql://results.cae10gzzpyrn.us-west-2.rds.amazonaws.com:3306/results"
     user="yogidmt"  password="bearbpa10"/>
<sql:query dataSource="${snapshot}" var="result">
SELECT * FROM records ORDER BY wins DESC;
</sql:query>
<ol>
<h2>Team 1</h2>
<form:form method="post" action="http://localhost/FirstSpringMVCProject/" modelAttribute="team">
<button type="submit" name="team" value="${matchup.teams[0]}${matchup.teams[1]}"/>${matchup.teams[0]}</button>
</form:form>
</ol>
<ol>
<h2>Team 2</h2>
<form:form method="post" action="http://localhost/FirstSpringMVCProject/" modelAttribute="team">
<button type="submit" name="team" value="${matchup.teams[1]}${matchup.teams[0]}"/>${matchup.teams[1]}</button>
</form:form>
</ol>
<h3>Results:</h3>
<c:forEach var="row" items="${result.rows}">
<c:out value="${row.player}"/> --- <c:out value="${row.winrate}"/>
</br>
</c:forEach>
</body>
</html>
package com.gontuseries.hellocontroller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloController {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView display() {     

        ModelAndView model = new ModelAndView("DisplayMatchup");
        model.addObject("matchup", new Matchup());

        return model;
    }

    @RequestMapping(value = "/", method = RequestMethod.POST)
    public ModelAndView update(@ModelAttribute("team") String s) {
        Util.updateParse(s);
        ModelAndView model = new ModelAndView("DisplayMatchup");
        model.addObject("matchup", new Matchup());

        return model;
    }
}
INFO: Illegal access: this web application instance has been stopped already.  Could not load .  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
Mar 23, 2017 10:27:21 AM org.apache.catalina.loader.WebappClassLoader findResourceInternal
Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: Error reading from remote server