关于linux部署项目后的错误暴露

来源:互联网 发布:盗版游戏 知乎 编辑:程序博客网 时间:2024/06/03 21:05

1、tomcat启动后  某些表找不到错误: 

INFO: 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 sca
nning can i:46ove startup time and JSP compilation time.
Exception in thread "SimpleAsyncTaskExecutor-1" org.springframework.jdbc.BadSqlGrammarException:
### Error querying database.Cause: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'mantouweixin.PUB_GLOBALCONFIG' doesn't exist
### The error may involvecom.eazer.pub.dao.IPubGlobalconfigMapper.selectModelList-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:Table 'mantouweixin.PUB_GLOBALCONFIG' doesn't exist
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'mantouweixin.PUB_GLOBALCONFIG' doesn't exist
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:346)
at com.sun.proxy.$Proxy15.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:196)
at com.eazer.base.MyBatisDaoManager.selectModelList(MyBatisDaoManager.java:214)
at com.eazer.pub.service.impl.PubGlobalconfigServiceImpl.load(PubGlobalconfigServiceImpl.java:109)
at com.eazer.pub.service.impl.PubGlobalconfigServiceImpl.loadCache(PubGlobalconfigServiceImpl.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at com.sun.proxy.$Proxy20.loadCache(Unknown Source)
at com.eazer.pub.service.impl.PubGlobalContextCache$1.run(PubGlobalContextCache.java:254)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:Table 'mantouweixin.PUB_GLOBALCONFIG' doesn't exist
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
Exception in thread "SimpleAsyncTaskExecutor-3"at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:882)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:39)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:55)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:41)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:238)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:112)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:38)
at com.eazer.base.page.ExecutorInterceptor.handAll(ExecutorInterceptor.java:158)
at com.eazer.base.page.ExecutorInterceptor.intercept(ExecutorInterceptor.java:130)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:68)
at com.sun.proxy.$Proxy28.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:338)
... 14 more
事件前提是我的项目中Mapper文件使用的sql语句都是大写
上网搜索发现 mysql配置文件中 是有一个默认属性的:lower_case_table_names
1) windows下mysql数据库是默认表名不区分大小写的, 参数值默认为1 , 所以windows环境下sql语句使用大小写都无所谓
2) 在linux下参数值默认为0(区分大小写)
3) 但是mysql建表后表名都是小写 所以此时我的项目部署上去启动后数据库找不到这些大写的表名 因此报错
4) download下来mysql配置文件:/etc/my.cnf
后重启mysql :service mysqld restart

2、项目部署后操作数据发现中文乱码问题

编辑了一个属性 就乱码了
1) 排除掉项目本身的和tomcat的配置文件编码属性 找到是因为mysql配置文件缺少自定义编码配置 因为其默认是Latin1编码
2) 编辑/etc/my.cnf : 图中三个位置

编辑完上传重启就行了

最开始安装mysql时我是选择让它默认安装的 包括路径之类的。mysql在运行时使用的配置文件之一就是my.cnf。安装完成后的my.cnf文件里面的属性配置基本没有 于是我去安装路径下 /usr/share/mysql 找的一个叫 my-large.cnf 的文件 复制到 /etc下更名为my.cnf 再进行的后续操作。

阅读全文
0 0
原创粉丝点击