Show SQL errors of Spring-security in tomcat

一个人想着一个人 提交于 2020-01-03 18:56:10

问题


I got a web application using the spring-security framework. I setted up a database to store users and their roles, but tomcat gives the following error.

17-sep-2010 11:56:14 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
17-sep-2010 11:56:14 org.springframework.jdbc.support.SQLErrorCodesFactory <init>
INFO: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]

Is there any way how i can see the errors that occurred? I couldn't find anything in the tomcat and mysql logs.

Im using tomcat 7.0.2 and mysql 5.1

Update: Added log4j.properties

log4j.rootLogger=warn, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.logger.org.springframework.security=DEBUG
# log4j.logger.org.springframework.target=System.out

and web.xml

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

No succes yet


回答1:


This message is not about an error occuring at runtime in your application:

INFO: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]

rather this is simply the Spring framework's JDBC support logging the fact that it has loaded support for translating error codes native to each of these SQL databases which translate into Spring's DataAccessException hierarchy. No error has occurred in the log message here.

If you want to be able to log more information about what Spring is doing, etc., the framework uses commons-logging and there are a number of ways to configure the actual output.




回答2:


I was using in my spring security something like select * from USER ...

change for select * from user .. and it works



来源:https://stackoverflow.com/questions/3736933/show-sql-errors-of-spring-security-in-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!