我使用Java / Spring Mvc网络应用程序开发比特币钱包。部署后,应用程序卡住,没有任何反应。我的意思是登陆页面在localhost中打开。之后,它应该在同步方面取得一些进展,并且按钮/下拉菜单应该是活动的。没有错误。我得到的唯一日志是WARNNING
和INFO
,
[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中的属性,如log: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
答案 0 :(得分:1)
您是否尝试更改conf/context.xml
中的属性,如日志:maxTotal
而不是maxActive
和maxWaitMillis
而不是maxWait
中所述?