一、
最近做一个常用表单上传下载模块,本机测试没问题,在测试系统测又出问题,好不容易测试系统没问题了,生产系统那边又有问题了。。。。真是环环相扣,丁点不能错啊!!!
1.生产系统遇到的第一个问题
[ERROR] 2016-11-04 09:26:37,680 method:gnhr.ww.json.CommonFileAction.list(CommonFileAction.java:193)
CommonFileAction Exception
com.microsoft.sqlserver.jdbc.SQLServerException: 对象名 ‘CommonFile‘ 无效。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
原因:
本地和测试系统的数据库跟生产系统的数据库不是同一个,生产系统的数据库里没CommonFile这个表
解决办法:
在生产系统的数据库新建一个和本地及测试系统一样的表CommonFile
2.生产系统遇到的第二个问题
2016-11-04 10:35:58,584 method:gnhr.dao.helper.BasicCommonFileHelper.pstmtInsert(BasicCommonFileHelper.java:223)
CommonFileHelper.pstmtInsert SQLException
com.microsoft.sqlserver.jdbc.SQLServerException: 不能将值 NULL 插入列 ‘FileId‘,表 ‘Gn_Hr.dbo.CommonFile‘;列不允许有空值。INSERT 失败。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(Unknown Source)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
原因:
CommonFile这个表里的主键FileId在本地和测试系统是设置为自增长,非空的,而生产系统的某某却没设置为自增长。
解决:
把生产系统的CommonFile表的FileId字段也设置成自增。
ohyea.!~!!