gpt4 book ai didi

部署 Tomcat 后 Java/Spring 应用卡住

转载 作者:行者123 更新时间:2023-11-28 22:49:33 24 4
gpt4 key购买 nike

我使用 Java/Spring Mvc 网络应用开发比特币钱包。部署后,应用程序卡住了,什么也没有发生。我的意思是登录页面在本地主机中打开。之后,它应该在同步方面取得一些进展,并且按钮/下拉菜单应该处于 Activity 状态。没有错误。我得到的唯一日志是一些 WARNNINGINFO,

[2017-06-28 11:25:03,820] Artifact BitcoinWalletApp:war exploded: Artifact is deployed successfully
[2017-06-28 11:25:03,820] Artifact BitcoinWalletApp:war exploded: Deploy took 6,195 milliseconds
org.hibernate.hql.internal.QueryTranslatorFactoryInitiator: 06/28/2017 11:25:04 - HHH000397: Using ASTQueryTranslatorFactory

28-Jun-2017 11:12:49.818 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/Applications/Tomcat-8.5.15/webapps/manager]
28-Jun-2017 11:12:49.845 WARNING [localhost-startStop-1] org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstance Name = spring Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "50" for "maxActive" property, which is being ignored.
28-Jun-2017 11:12:49.845 WARNING [localhost-startStop-1] org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstance Name = spring Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "10000" for "maxWait" property, which is being ignored.
28-Jun-2017 11:12:49.855 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Applications/Tomcat-8.5.15/webapps/manager] has finished in [36] ms

database-context.xml文件中,提供了JNDI配置,

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">

<context:annotation-config></context:annotation-config>

<context:component-scan base-package="mobi.puut.database">
</context:component-scan>

<beans profile="production">
<context:property-placeholder
location="classpath:mobi/puut/config/jdbc.properties"/>

<!--<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"-->
<!--destroy-method="close">-->
<!--<property name="driverClassName" value="${jdbc.driver}"></property>-->
<!--<property name="url" value="${jdbc.url}"></property>-->
<!--<property name="password" value="${jdbc.password}"></property>-->
<!--<property name="username" value="${jdbc.username}"></property>-->
<!--</bean>-->

<jee:jndi-lookup jndi-name="jdbc/spring" id="dataSource"
expected-type="javax.sql.DataSource">
</jee:jndi-lookup>

<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<!--<prop key="hibernate.hbm2ddl.auto">create</prop>-->
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.use_sql_comments">false</prop>
</props>
</property>

<property name="packagesToScan" value="mobi.puut.entities"/>
</bean>

<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>

<tx:annotation-driven transaction-manager="transactionManager"/>


<bean id="exceptionTranslator"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor">
</bean>
</beans>
</beans>

web.xml中,数据库引用如下,

<description>Spring Database</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/spring</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Tomcat 中,Resource 信息由 conf/context.xml 提供,如下所示,

<Resource name="jdbc/spring" auth="Container" type="javax.sql.DataSource"
maxActive="50" maxIdle="30" maxWait="10000"
username="testname" password="testpassword"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/wallet"/>

如果需要,我可以提供更多信息。问题是什么以及如何解决?

更新

我已经更改了 conf/context.xml 中的属性,如日志中所述:maxTotal 代替 maxActive 和 maxWaitMillis 代替 maxWait 并且 WARNING 消失了。它仍然卡住了。

28-Jun-2017 15:54:05.451 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/Applications/Tomcat-9.0.0.M21/webapps/manager]
28-Jun-2017 15:54:05.486 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Applications/Tomcat-9.0.0.M21/webapps/manager] has finished in [34] ms

最佳答案

您是否尝试过更改 conf/context.xml 中的属性,如日志中所述:maxTotal 而不是 maxActivemaxWaitMillis 而不是 maxWait

关于部署 Tomcat 后 Java/Spring 应用卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44794329/

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