我已将Shopizer war文件部署到Tomcat Elastic Beanstalk实例。我已经配置了一个mySQL数据库,据我所知,一切都应该是正确的。问题是当我尝试访问URL时出现502错误。我知道Elastic Beanstalk会在60秒后超时,所以我增加了超时限制,但仍然遇到了问题。
我在Catalina.out日志中注意到了这一点。我知道它只是一个警告,但它可能指向我的问题吗?
2018-05-02 06:02:51.220 WARN 3233 --- [-AdminTaskTimer] c.m.v.a.ThreadPoolAsynchronousRunner:com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@4446a77 - APPARENT DEADLOCK !!!完成状态: 管理线程:3 活动主题:3 活动任务: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@55aa1343 线程上:C3P0PooledConnectionPoolManager [identityToken-> 1br9tjp9v8puiagh4cnwb | 550ee827] -HelperThread-#2 com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@326b931e 线程上:C3P0PooledConnectionPoolManager [identityToken-> 1br9tjp9v8puiagh4cnwb | 550ee827] -HelperThread-#0 com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@7fc7b7d9 线程上:C3P0PooledConnectionPoolManager [identityToken-> 1br9tjp9v8puiagh4cnwb | 550ee827] -HelperThread-#1 待定任务: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@591e9ef6 池线程堆栈跟踪: 螺纹[C3P0PooledConnectionPoolManager [identityToken-> 1br9tjp9v8puiagh4cnwb | 550ee827] -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-> 1br9tjp9v8puiagh4cnwb | 550ee827] -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-> 1br9tjp9v8puiagh4cnwb | 550ee827] -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)
2018-05-02 06:03:51.222 WARN 3233 --- [-AdminTaskTimer] cmvaThreadPoolAsynchronousRunner:任务com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@55aa1343(在死锁的PoolThread中)无法在最长时间内完成60000毫秒。尝试中断()。 2018-05-02 06:03:51.222 WARN 3233 --- [-AdminTaskTimer] c.m.v.a.ThreadPoolAsynchronousRunner:任务com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@326b931e(在死锁的PoolThread中)无法在60000ms的最长时间内完成。尝试中断()。 2018-05-02 06:03:51.222 WARN 3233 --- [-AdminTaskTimer] c.m.v.a.ThreadPoolAsynchronousRunner:任务com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@7fc7b7d9(在死锁的PoolThread中)无法在最长60000ms内完成。尝试中断()。
答案 0 :(得分:1)
我搞砸了很多步骤,并没有看过什么帮助,什么没有。如果我有机会通过这个并提供更具体的帮助,我会这样,但是现在,继续我的所作所为。
在sm-shop/src/main/resources/application.properties
添加:
server.port = 5000
从创建数据库开始。您将需要database.properties文件的详细信息。我创建了一个mySQL Aurora DB。
sm-shop/src/main/resources/database.properties
。在配置>软件设置如下:
Initial JVM heap size (Xms) = 1024m
Max JVM heap size (Xmx) = 1024m
XX:MaxPermSize = 256m
添加以下环境属性:
HIBERNATE_DIALECT = org.hibernate.dialect.MySQLDialect
JDBC_CONNECTION_STRING = jdbc:mysql://mydb.ptmjbhdur9pw.eu-west-2.rds.amazonaws.com:3306/SALESMANAGER?user=username&password=password&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&&driverClass=com.mysql.cj.jdbc.Driver
SERVER_PORT = 5000
在配置>修改实例:
Instance type = (at least)m1.small
EC2安全组 - 我在这里勾选了数据库安全组。
在配置>负载均衡器添加以下侦听器:
Port = 8080
Protocol = HTTP
Instance Port = 8080
Instance Protocol = HTTP
当完成所有操作并且我在没有任何明显的AWS问题的情况下启动应用程序时,应用程序将无法加载,因此我检查了Catalina日志。它显示了与https://groups.google.com/forum/#!searchin/shopizer/ru%7Csort:date/shopizer/hQjqp_5UswI/goVKf5BTCQAJ中相同的错误,因此我进行了更改。应用程序现在加载。
我希望能节省一些时间(和悲伤)。