"在 STS 中部署的 symphony, 报错:找不到 user 表。 [ERROR]-[2018-11-06 09:34:07]-[org.b3log.latke.repository.jdbc.JdbcRepository:490]: Query failed java.sql.SQLSyntaxErrorExce .."

Symphony 为什么不会自动建表

在 STS 中部署的 symphony, 报错:找不到 user 表。

[ERROR]-[2018-11-06 09:34:07]-[org.b3log.latke.repository.jdbc.JdbcRepository:490]: Query failed
java.sql.SQLSyntaxErrorException: Table 'b3log_symphony.symphony_user' doesn't exist
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:975)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1025)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
	at org.b3log.latke.repository.jdbc.util.JdbcUtil.queryJson(JdbcUtil.java:159)
	at org.b3log.latke.repository.jdbc.util.JdbcUtil.queryJsonArray(JdbcUtil.java:130)
	at org.b3log.latke.repository.jdbc.JdbcRepository.get(JdbcRepository.java:486)
	at org.b3log.latke.repository.AbstractRepository.get(AbstractRepository.java:159)
	at org.b3log.latke.repository.Repository.getList(Repository.java:133)
	at org.b3log.symphony.repository.UserRepository.getAdmins(UserRepository.java:149)
	at org.b3log.symphony.repository.UserRepository_$$_jvst451_28._d10getAdmins(UserRepository_$$_jvst451_28.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.b3log.latke.ioc.JavassistMethodHandler.invoke(JavassistMethodHandler.java:126)
	at org.b3log.symphony.repository.UserRepository_$$_jvst451_28.getAdmins(UserRepository_$$_jvst451_28.java)
	at org.b3log.symphony.service.UserQueryService.getAdmins(UserQueryService.java:397)
	at org.b3log.symphony.service.UserQueryService_$$_jvst451_2b._d3getAdmins(UserQueryService_$$_jvst451_2b.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.b3log.latke.ioc.JavassistMethodHandler.invoke(JavassistMethodHandler.java:126)
	at org.b3log.symphony.service.UserQueryService_$$_jvst451_2b.getAdmins(UserQueryService_$$_jvst451_2b.java)
	at org.b3log.symphony.service.InitMgmtService.initSym(InitMgmtService.java:222)
	at org.b3log.symphony.service.InitMgmtService_$$_jvst451_40._d5initSym(InitMgmtService_$$_jvst451_40.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.b3log.latke.ioc.JavassistMethodHandler.invoke(JavassistMethodHandler.java:126)
	at org.b3log.symphony.service.InitMgmtService_$$_jvst451_40.initSym(InitMgmtService_$$_jvst451_40.java)
	at org.b3log.symphony.SymphonyServletListener.contextInitialized(SymphonyServletListener.java:89)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
[ERROR]-[2018-11-06 09:34:07]-[org.b3log.symphony.service.UserQueryService:399]: Gets admins failed
org.b3log.latke.repository.RepositoryException: java.sql.SQLSyntaxErrorException: Table 'b3log_symphony.symphony_user' doesn't exist
	at org.b3log.latke.repository.jdbc.JdbcRepository.get(JdbcRepository.java:492)
	at org.b3log.latke.repository.AbstractRepository.get(AbstractRepository.java:159)
	at org.b3log.latke.repository.Repository.getList(Repository.java:133)
	at org.b3log.symphony.repository.UserRepository.getAdmins(UserRepository.java:149)
	at org.b3log.symphony.repository.UserRepository_$$_jvst451_28._d10getAdmins(UserRepository_$$_jvst451_28.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.b3log.latke.ioc.JavassistMethodHandler.invoke(JavassistMethodHandler.java:126)
	at org.b3log.symphony.repository.UserRepository_$$_jvst451_28.getAdmins(UserRepository_$$_jvst451_28.java)
	at org.b3log.symphony.service.UserQueryService.getAdmins(UserQueryService.java:397)
	at org.b3log.symphony.service.UserQueryService_$$_jvst451_2b._d3getAdmins(UserQueryService_$$_jvst451_2b.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.b3log.latke.ioc.JavassistMethodHandler.invoke(JavassistMethodHandler.java:126)
	at org.b3log.symphony.service.UserQueryService_$$_jvst451_2b.getAdmins(UserQueryService_$$_jvst451_2b.java)
	at org.b3log.symphony.service.InitMgmtService.initSym(InitMgmtService.java:222)
	at org.b3log.symphony.service.InitMgmtService_$$_jvst451_40._d5initSym(InitMgmtService_$$_jvst451_40.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.b3log.latke.ioc.JavassistMethodHandler.invoke(JavassistMethodHandler.java:126)
	at org.b3log.symphony.service.InitMgmtService_$$_jvst451_40.initSym(InitMgmtService_$$_jvst451_40.java)
	at org.b3log.symphony.SymphonyServletListener.contextInitialized(SymphonyServletListener.java:89)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: java.sql.SQLSyntaxErrorException: Table 'b3log_symphony.symphony_user' doesn't exist
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:975)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1025)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
	at org.b3log.latke.repository.jdbc.util.JdbcUtil.queryJson(JdbcUtil.java:159)
	at org.b3log.latke.repository.jdbc.util.JdbcUtil.queryJsonArray(JdbcUtil.java:130)
	at org.b3log.latke.repository.jdbc.JdbcRepository.get(JdbcRepository.java:486)
	... 57 more

  • Sym

    Sym 是一个用 Java 实现的现代化社区(论坛 / 社交网络 / 博客)平台,“下一代的社区系统,为未来而构建”。黑客派就是使用该系统搭建的 ❤️

    353 引用 • 3799 回帖 • 644 关注
  • Q&A

    提问之前请先看一下这篇文章 《提问的智慧》精读注解版,好的问题比好的答案更有价值。

    804 引用 • 5038 回帖 • 610 关注
感谢    关注    收藏    赞同    反对    举报    分享
被采纳的回答
  • 88250 1 感谢    

    代码确实有 bug,已经修复,重新拉一下 master 谢谢!

12 回帖    
请输入回帖内容...
  • 88250      

    正常情况下会在第一次启动的时候自动建表,你观察一下启动日志。

    1 回复 
    感谢    赞同    反对    举报    分享       回复
  • lzxawcy            

    启动日志没有建表的信息

    [INFO ]-[2018-11-06 10:12:01]-[org.b3log.symphony.SymphonyServletListener:80]: Sym process [pid=2804]
    [WARN ]-[2018-11-06 10:12:01]-[org.b3log.latke.Latkes:635]: !!!!Runtime mode is [DEVELOPMENT], please make sure configured it with [PRODUCTION] in latke.properties if deployed on production environment!!!!
    [INFO ]-[2018-11-06 10:12:01]-[org.b3log.symphony.processor.FileUploadProcessor:87]: Uses dir [C:\Users\xiang\AppData\Roaming\STS\sts-3.9.5.RELEASE\.\upload] for file uploading
    [INFO ]-[2018-11-06 10:12:01]-[org.b3log.latke.repository.jdbc.util.Connections:129]: Initialized database connection pool [hikari]
    [INFO ]-[2018-11-06 10:12:01]-[com.zaxxer.hikari.HikariDataSource:110]: HikariPool-1 - Starting...
    [INFO ]-[2018-11-06 10:12:02]-[com.zaxxer.hikari.HikariDataSource:123]: HikariPool-1 - Start completed.
    [ERROR]-[2018-11-06 10:12:02]-[org.b3log.latke.repository.jdbc.JdbcRepository:490]: Query failed
    

    从这里开始就是上述的报错了

    1 回复 
    感谢    赞同    反对    举报    分享       回复
  • 88250            

    把数据库里面的表删了重新启动再看看。

    2 回复 
    感谢    赞同    反对    举报    分享       回复
  • lzxawcy            

    b3log_symphony 数据库中一直没有创建任何表,mysql 是 5.7 版本,我其他项目使用数据库没有问题。

    感谢    赞同    反对    举报    分享       回复
  • lzxawcy      

    打成 war 包在放到 webapps 中启动的日志出现警告:

    06-Nov-2018 10:35:33.642 信息 [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying deployment descriptor [C:\mysoftware\apache-tomcat-9.0.12\conf\Catalina\localhost\symphony.xml]
    06-Nov-2018 10:35:33.661 警告 [main] org.apache.catalina.startup.HostConfig.deployDescriptor The path attribute with value [/symphony] in deployment descriptor [C:\mysoftware\apache-tomcat-9.0.12\conf\Catalina\localhost\symphony.xml] has been ignored
    06-Nov-2018 10:35:33.679 警告 [main] org.apache.catalina.startup.HostConfig.deployDescriptor A docBase [C:\mysoftware\apache-tomcat-9.0.12\webapps\Symphony] inside the host appBase has been specified, and will be ignored
    06-Nov-2018 10:35:33.685 警告 [main] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Symphony' did not find a matching property.
    06-Nov-2018 10:35:37.058 信息 [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    

    下面的报错和之前的一样是找不到表。

    感谢    赞同    反对    举报    分享       回复
  • 88250 1 感谢        

    代码确实有 bug,已经修复,重新拉一下 master 谢谢!

    1 回复 
    感谢    赞同    反对    举报    分享       回复
  • lzxawcy            

    谢谢,更新后就可以用了

    感谢    赞同    反对    举报    分享       回复
  • tanglong            

    ERROR]-[2019-02-12 14:52:27]-[org.b3log.latke.repository.jdbc.util.Connections:132]: Can not initialize database connection pool java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver 已经对 local.properties 里面的数据库用户名和密码进行了配置,也开启了 sql 数据库,并建好了数据库 b3blog_symphony, 但是还是报了上面的错误信息

    1 回复 
    感谢    赞同    反对    举报    分享       回复
  • 88250            

    看上去是打包有问题,MySQL 驱动 jar 没有找到。

    1 回复 
    感谢    赞同    反对    举报    分享       回复
  • tanglong            

    是的,可是打包一般不是自动的嘛,也没有太特殊的操作把

    1 回复 
    感谢    赞同    反对    举报    分享       回复
  • 88250            

    没有特殊操作,你可能需要仔细看下打包过程输出的日志,看看是不是遗漏了什么提示信息。

    1 回复 
    感谢    赞同    反对    举报    分享       回复
  • tanglong            

    好的,谢谢

    感谢    赞同    反对    举报    分享       回复
请输入回帖内容...