启动服务器时报找不到表,但实际创建表成功了,这是为什么?
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'gs_table.r_prize' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1383)
at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:35)
at org.nutz.dao.impl.NutDao$12.invoke(NutDao.java:816)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:59)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
at org.nutz.dao.impl.NutDao.exists(NutDao.java:808)
at org.nutz.dao.impl.NutDao.create(NutDao.java:777)
at org.nutz.dao.util.Daos.createTablesInPackage(Daos.java:537)
at com.risun.gs.MainSetup.init(MainSetup.java:25)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2016-06-13 11:54:44,074 com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:85) DEBUG - Attempted to convert SQLException to SQLException. Leaving it alone. [SQLState: 42S02; errorCode: 1146]
10 回复
我刷新数据库之后,数据库中就已经出现这两张表,创建表的语句都已经生成了
CREATE TABLE r_prize(
id BIGINT(64) AUTO_INCREMENT,
openID VARCHAR(50),
headImg VARCHAR(50),
nickName VARCHAR(50),
attendDate VARCHAR(50),
remark VARCHAR(50),
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
我好像也碰到过的,日志如下
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'wx-nutz.user_location' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.Util.getInstance(Util.java:387)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2363)
at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeQuery(StatementProxyImpl.java:211)
at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:143)
at org.nutz.dao.impl.NutDao$12.invoke(NutDao.java:816)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:59)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:250)
at org.nutz.dao.impl.NutDao.exists(NutDao.java:808)
at org.nutz.dao.impl.NutDao.create(NutDao.java:777)
at org.nutz.dao.util.Daos.createTablesInPackage(Daos.java:543)
at net.hzfanqun.weixin.modules.MainSetup.init(MainSetup.java:17)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4908)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5602)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2016-06-13 21:32:33,531 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20008} closed
2016-06-13 21:32:33,531 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-recycle
2016-06-13 21:32:33,533 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-connect
2016-06-13 21:32:33,533 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20009} created
2016-06-13 21:32:33,535 [ERROR][druid.sql.Statement.statementLogError] - {conn-10010, stmt-20009} execute error. SELECT * FROM user_location LIMIT 1
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'wx-nutz.user_location' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.Util.getInstance(Util.java:387)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2363)
at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeQuery(StatementProxyImpl.java:211)
at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:143)
at org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:78)
at org.nutz.dao.impl.entity.AnnotationEntityMaker._checkupEntityFieldsWithDatabase(AnnotationEntityMaker.java:549)
at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:278)
at org.nutz.dao.impl.EntityHolder.reloadEntity(EntityHolder.java:81)
at org.nutz.dao.impl.NutDao.create(NutDao.java:784)
at org.nutz.dao.util.Daos.createTablesInPackage(Daos.java:543)
at net.hzfanqun.weixin.modules.MainSetup.init(MainSetup.java:17)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4908)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5602)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2016-06-13 21:32:33,536 [DEBUG][org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField] - Table 'user_location' doesn't exist!
2016-06-13 21:32:33,536 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20009} closed
2016-06-13 21:32:33,536 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-recycle
2016-06-13 21:32:33,537 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-connect
2016-06-13 21:32:33,537 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement] - CREATE TABLE user_location(
id INT(32) AUTO_INCREMENT,
open_id VARCHAR(50),
label VARCHAR(128),
lng VARCHAR(50),
lat VARCHAR(50),
bd09_lng VARCHAR(50),
bd09_lat VARCHAR(50),
create_time DATETIME,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
2016-06-13 21:32:33,537 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20010} created
2016-06-13 21:32:33,585 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20010} executed. 47.242151 millis.
CREATE TABLE user_location(
id INT(32) AUTO_INCREMENT,
open_id VARCHAR(50),
label VARCHAR(128),
lng VARCHAR(50),
lat VARCHAR(50),
bd09_lng VARCHAR(50),
bd09_lat VARCHAR(50),
create_time DATETIME,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
2016-06-13 21:32:33,585 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20010} closed
2016-06-13 21:32:33,585 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-recycle
2016-06-13 21:32:33,586 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-connect
2016-06-13 21:32:33,586 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-recycle
2016-06-13 21:32:33,586 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-connect
2016-06-13 21:32:33,586 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-recycle
2016-06-13 21:32:33,586 [DEBUG][druid.sql.Connection.connectionLog] - {conn-10010} pool-connect
2016-06-13 21:32:33,587 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20011} created
2016-06-13 21:32:33,609 [DEBUG][druid.sql.Statement.statementLog] - {conn-10010, stmt-20011, rs-50005} query executed. 21.499479 millis.
这是nutz检测表是否 存在的堆栈
at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:143)
at org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:78)
at org.nutz.dao.impl.entity.AnnotationEntityMaker._checkupEntityFieldsWithDatabase(AnnotationEntityMaker.java:549)
at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:278)
at org.nutz.dao.impl.EntityHolder.reloadEntity(EntityHolder.java:81)
添加回复
请先登陆