访问Elastic Beanstalk端点

时间:2018-04-09 06:51:41

标签: java amazon-web-services tomcat elastic-beanstalk

我在Elastic Beanstalk上运行Java Web应用程序时遇到问题。

它使用mySQL数据库,我已经在Aurora mySQL服务上运行,当我的应用程序在我的Mac上本地运行时,我已经能够连接并使用它。

我还创建了一个Elastic Beanstalk服务并将WAR文件部署到它,但当我尝试访问它生成的端点时,我得到了下面的502错误:

  

代理错误

     

代理服务器收到来自上游服务器的无效响应。   代理服务器无法处理请求GET /.

     

原因:从远程服务器读取错误

60秒后似乎超时。

我尝试在.ebextensions/httpd/conf/httpd.conf中设置更长的Timeout和KeepAliveTimeout值,但这只会导致端点在投掷502之前挂起更长时间。

我已经下载了EB日志,其中一件事就是catalina.out提取的内容:

  

托管主题:3       活动主题:3       活动任务:           com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5818f545               线程上:C3P0PooledConnectionPoolManager [identityToken-> 1br9sm89u1au3ktt1ubpi4i | 3c8f06c7] -HelperThread-#2           com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@3356cf8f               线程上:C3P0PooledConnectionPoolManager [identityToken-> 1br9sm89u1au3ktt1ubpi4i | 3c8f06c7] -HelperThread-#0           com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@789ae24e               线程上:C3P0PooledConnectionPoolManager [identityToken-> 1br9sm89u1au3ktt1ubpi4i | 3c8f06c7] -HelperThread-#1       待定任务:           com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@32776cec   池线程堆栈跟踪:       螺纹[C3P0PooledConnectionPoolManager [identityToken-> 1br9sm89u1au3ktt1ubpi4i | 3c8f06c7] -HelperThread-#2,5,主]           java.net.PlainSocketImpl.socketConnect(本机方法)           java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)           java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)           java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)           java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)           java.net.Socket.connect(Socket.java:589)           com.mysql.cj.core.io.StandardSocketFactory.connect(StandardSocketFactory.java:202)           com.mysql.cj.mysqla.io.MysqlaSocketConnection.connect(MysqlaSocketConnection.java:57)           com.mysql.cj.mysqla.MysqlaSession.connect(MysqlaSession.java:122)           com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:1619)           com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1601)           com.mysql.cj.jdbc.ConnectionImpl。(ConnectionImpl.java:633)           com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)           com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)           com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)           com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)           com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)           com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool $ 1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)           com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)           com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)           com.mchange.v2.resourcepool.BasicResourcePool.access $ 700(BasicResourcePool.java:44)           com.mchange.v2.resourcepool.BasicResourcePool $ ScatteredAcquireTask.run(BasicResourcePool.java:1870)           com.mchange.v2.async.ThreadPoolAsynchronousRunner $ PoolThread.run(ThreadPoolAsynchronousRunner.java:696)       螺纹[C3P0PooledConnectionPoolManager [identityToken-> 1br9sm89u1au3ktt1ubpi4i | 3c8f06c7] -HelperThread-#0,5,主]           java.net.PlainSocketImpl.socketConnect(本机方法)           java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)           java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)           java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)           java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)           java.net.Socket.connect(Socket.java:589)           com.mysql.cj.core.io.StandardSocketFactory.connect(StandardSocketFactory.java:202)           com.mysql.cj.mysqla.io.MysqlaSocketConnection.connect(MysqlaSocketConnection.java:57)           com.mysql.cj.mysqla.MysqlaSession.connect(MysqlaSession.java:122)           com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:1619)           com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1601)           com.mysql.cj.jdbc.ConnectionImpl。(ConnectionImpl.java:633)           com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)           com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)           com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)           com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)           com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)           com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool $ 1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)           com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)           com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)           com.mchange.v2.resourcepool.BasicResourcePool.access $ 700(BasicResourcePool.java:44)           com.mchange.v2.resourcepool.BasicResourcePool $ ScatteredAcquireTask.run(BasicResourcePool.java:1870)           com.mchange.v2.async.ThreadPoolAsynchronousRunner $ PoolThread.run(ThreadPoolAsynchronousRunner.java:696)       螺纹[C3P0PooledConnectionPoolManager [identityToken-> 1br9sm89u1au3ktt1ubpi4i | 3c8f06c7] -HelperThread-#1,5,主]           java.net.PlainSocketImpl.socketConnect(本机方法)           java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)           java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)           java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)           java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)           java.net.Socket.connect(Socket.java:589)           com.mysql.cj.core.io.StandardSocketFactory.connect(StandardSocketFactory.java:202)           com.mysql.cj.mysqla.io.MysqlaSocketConnection.connect(MysqlaSocketConnection.java:57)           com.mysql.cj.mysqla.MysqlaSession.connect(MysqlaSession.java:122)           com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:1619)           com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1601)           com.mysql.cj.jdbc.ConnectionImpl。(ConnectionImpl.java:633)           com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)           com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)           com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)           com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)           com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)           com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool $ 1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)           com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)           com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)           com.mchange.v2.resourcepool.BasicResourcePool.access $ 700(BasicResourcePool.java:44)           com.mchange.v2.resourcepool.BasicResourcePool $ ScatteredAcquireTask.run(BasicResourcePool.java:1870)           com.mchange.v2.async.ThreadPoolAsynchronousRunner $ PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

有人知道如何解决这个问题,甚至我应该如何调查它?我对AWS完全陌生并且正在努力。

1 个答案:

答案 0 :(得分:0)

这里的问题是我最初选择的实例不够强大,无法处理我的请求。我从t1.micro(我认为)切换到m1.small。这解决了这个问题。