gpt4 book ai didi

amazon-web-services - 将 war 文件部署到 Tomcat 时出现 Elastic Beanstalk 502 错误

转载 作者:行者123 更新时间:2023-11-28 22:48:13 26 4
gpt4 key购买 nike

我已将 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!!! Complete Status: Managed Threads: 3 Active Threads: 3 Active Tasks: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@55aa1343 on thread: C3P0PooledConnectionPoolManager[identityToken->1br9tjp9v8puiagh4cnwb|550ee827]-HelperThread-#2 com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@326b931e on thread: C3P0PooledConnectionPoolManager[identityToken->1br9tjp9v8puiagh4cnwb|550ee827]-HelperThread-#0 com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@7fc7b7d9 on thread: C3P0PooledConnectionPoolManager[identityToken->1br9tjp9v8puiagh4cnwb|550ee827]-HelperThread-#1 Pending Tasks: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@591e9ef6 Pool thread stack traces: Thread[C3P0PooledConnectionPoolManager[identityToken->1br9tjp9v8puiagh4cnwb|550ee827]-HelperThread-#2,5,main] java.net.PlainSocketImpl.socketConnect(Native Method) 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) Thread[C3P0PooledConnectionPoolManager[identityToken->1br9tjp9v8puiagh4cnwb|550ee827]-HelperThread-#0,5,main] java.net.PlainSocketImpl.socketConnect(Native Method) 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) Thread[C3P0PooledConnectionPoolManager[identityToken->1br9tjp9v8puiagh4cnwb|550ee827]-HelperThread-#1,5,main] java.net.PlainSocketImpl.socketConnect(Native Method) 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] c.m.v.a.ThreadPoolAsynchronousRunner : Task com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@55aa1343 (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt(). 2018-05-02 06:03:51.222 WARN 3233 --- [-AdminTaskTimer] c.m.v.a.ThreadPoolAsynchronousRunner : Task com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@326b931e (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt(). 2018-05-02 06:03:51.222 WARN 3233 --- [-AdminTaskTimer] c.m.v.a.ThreadPoolAsynchronousRunner : Task com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@7fc7b7d9 (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt().

最佳答案

我搞砸了好几个步骤,还没有看清楚哪些有用,哪些没用。如果我有机会经历这些并提供更具体的帮助,我会的,但现在,我是这样做的。

  • sm-shop/src/main/resources/application.properties 添加:

    server.port = 5000

  • 从创建数据库开始。您将需要 database.properties 文件的详细信息。我创建了一个 mySQL Aurora 数据库。

  • 将数据库属性添加到 sm-shop/src/main/resources/database.properties
  • 在 AWS 中,创建 Elastic Beanstalk 应用程序和环境。我使用了 Tomcat,因此必须构建一个 war 文件,并将其部署到环境中。
  • 在配置 > 软件中设置以下内容:

    初始 JVM 堆大小 (Xms) = 1024m
    最大 JVM 堆大小 (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=用户名&密码=密码&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&&driverClass=com.mysql.cj.jdbc。司机
    SERVER_PORT = 5000

  • 在配置 > 修改实例中:

    实例类型 =(至少)m1.small EC2 安全组 - 我在这里勾选了数据库安全组。

  • 在配置 > 修改容量中: 环境类型 = 负载均衡
  • 在配置 > 负载均衡器中添加以下监听器:

    端口 = 8080
    协议(protocol) = HTTP
    实例端口 = 8080
    实例协议(protocol) = HTTP

当所有这些都完成并且我在没有任何明显的 AWS 问题的情况下启动应用程序时,应用程序不会加载,所以我检查了 Catalina 日志。它显示与 https://groups.google.com/forum/#!searchin/shopizer/ru%7Csort:date/shopizer/hQjqp_5UswI/goVKf5BTCQAJ 中相同的错误所以我做了那个改变。应用程序现在加载。

我希望这可以节省一些时间(和悲伤)。

关于amazon-web-services - 将 war 文件部署到 Tomcat 时出现 Elastic Beanstalk 502 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50128283/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com