搭建Web应用问题遇见问题及对应解决方法总结

前言

为了运行我的静态分析算法而不得不搭建一些web应用程序,有些struts的应用因为存在较为久远无法直接部署使用,这次遇到的问题包括前端后端。深感docker大法好

正篇

问题1:

描述 授权root权限给应用后,本来指定db1给应用,但是 hibernate 却在建表时连接到db2的表,从而导致在此使用db1中的某些表时,table not found
解决 为该应用创建一个单独的、只能访问db1的用户

问题2:

描述
Unexpected Exception caught setting 'username' on 'class com.wt.xx.xx: Error setting expression 'x' with value ['XX', ] Error setting expression 'username' with value ['XXXX', ] - [unknown location]
Caused by: No object in the CompoundRoot has a publicly accessible property named 'xxx' (no setter...
解决
在struts处于开发者模式时会报出问题,若对功能不影响则在struts.xml内关掉即可;
否则,查看对应的action是否有setter

问题3:

描述
java.sql.SQLException: Unknown system variable 'tx_isolation' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2477) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422) at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3131) at com.mchange.v2.c3p0.impl.NewPooledConnection.<init>(NewPooledConnection.java:107) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:198) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) DEBUG - An exception occurred while acquiring a poolable resource. Will retry. java.sql.SQLException: Unknown system variable 'tx_isolation' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2477) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422) at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3131) at com.mchange.v2.c3p0.impl.NewPooledConnection.<init>(NewPooledConnection.java:107) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:198) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

解决 应用程序使用的mysql驱动和本地数据库版本不一致,本地数据库8.5,驱动5。将应用lib中的mysql驱动换成8.x即可

问题4:

描述 看不见输出日志或者log4j加载错误
解决web.xml中将log4jConfigLocation 添加并置于 contextConfigLocation之前,如下图

	<context-param>  
        <param-name>log4jConfigLocation</param-name>  
        <param-value>classpath:log4j.properties</param-value>  
    </context-param> 
    
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext*.xml</param-value>
	</context-param>

问题5:

问题 之前改过的前端文件,再次部署时无法加载
解决 清除浏览器缓存

上一篇:go基础—运算符


下一篇:tortoisegit 还原到某个版本