-
[Spring] 카페24 호스팅 500 Internal Server Error 해결방법BACK-END/Spring 2021. 1. 10. 21:26
해결법은 글 맨 밑에 있습니다!
오늘은 회원 테이블을 생성한 후 war파일을 서버에 올리고 로그인과 회원가입 테스트를 했다. 그런데 자꾸 "500 Internal Server Error" 가 나왔다. 분명히 STS에서 전부 테스트 해보고 아무 문제가 없었는데 왜 war 배포만 하면 이런 문제가 생기는건지 .. 아무튼 해결해보려고 열심히 구글링을 해보다가 DB 문제인것 같아서 내 카페24에 내 MySQL DB를 Import 해야겠다고 생각이 들었다. 그래야 서버에서 내가 만든 테이블을 가지고 CRUD를 하는것 같았다.
그래서 MySQL 에서 현재 내 스키마를 통째로 Import 하고 SQL 파일을 FileZilla Root 폴더에 집어넣었다. Import 하는 방법은 MySQL workbench 상단의 Server-Import 하면 됌.
그리고 카페24 백업받기/올리기 로 들어가서 현재 sql 파일의 경로를 지정해줬다. 복구하기 버튼을 누르니까 3분 후에 해당 경로를 확인해보라고 안내 멘트가 나왔다.
제대로 올라간거 맞나 싶어서 이번에는 역으로 올라간걸 백업받기를 통해서 최상위 폴더에 다운로드 받았다.
확인해보니 확장명이 dump로 다운로드 받아졌다. 더블클릭해서 로컬 디렉토리에 다운로드했다.
연결프로그램을 메모장으로 한 후 열어서 살펴봤다.
주석이 많아서 읽기가 조금 힘들었지만 자세히 보니 내가 만들어둔 User 테이블이 보였다.
즉 내 서버에 DB가 제대로 올라갔다는것이다.
하.. 근데 아직도 회원가입과 로그인을 시도했을때 Internal Server Error 가 뜬다....
왜지.. 서버에도 내 DB가 있고 DB연결 잘 되있는데.. DB 문제가 아니라 스크립트 문제인건가...
디버깅 다시 시작.. 후
F12를 누르면 나오는 개발자도구에서 문제가 발생한 URL을 누르니 에러 사유를 자세히 볼 수 있었다. 스압주의
HTTP Status 500 - Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: type Exception report message Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) ### The error may exist in file [/discussadmin/tomcat/webapps/discuss/WEB-INF/classes/mapper/mysql/user.xml] ### The error may involve user.signupIdCheck ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) root cause org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) ### The error may exist in file [/discussadmin/tomcat/webapps/discuss/WEB-INF/classes/mapper/mysql/user.xml] ### The error may involve user.signupIdCheck ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364) com.sun.proxy.$Proxy29.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159) com.discuss.issue.model.dao.UserDAOImp.signupIdCheck(UserDAOImp.java:17) com.discuss.issue.HomeController.idCheck(HomeController.java:72) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) root cause org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) ### The error may exist in file [/discussadmin/tomcat/webapps/discuss/WEB-INF/classes/mapper/mysql/user.xml] ### The error may involve user.signupIdCheck ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354) com.sun.proxy.$Proxy29.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159) com.discuss.issue.model.dao.UserDAOImp.signupIdCheck(UserDAOImp.java:17) com.discuss.issue.HomeController.idCheck(HomeController.java:72) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) root cause org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80) org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:66) org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279) org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:72) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:59) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354) com.sun.proxy.$Proxy29.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159) com.discuss.issue.model.dao.UserDAOImp.signupIdCheck(UserDAOImp.java:17) com.discuss.issue.HomeController.idCheck(HomeController.java:72) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) root cause org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80) org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:66) org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279) org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:72) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:59) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354) com.sun.proxy.$Proxy29.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159) com.discuss.issue.model.dao.UserDAOImp.signupIdCheck(UserDAOImp.java:17) com.discuss.issue.HomeController.idCheck(HomeController.java:72) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) root cause java.sql.SQLException: Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES) com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:875) com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1712) com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1228) com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083) com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806) com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:423) com.mysql.jdbc.Util.handleNewInstance(Util.java:404) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328) org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80) org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:66) org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279) org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:72) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:59) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354) com.sun.proxy.$Proxy29.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159) com.discuss.issue.model.dao.UserDAOImp.signupIdCheck(UserDAOImp.java:17) com.discuss.issue.HomeController.idCheck(HomeController.java:72) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) note The full stack trace of the root cause is available in the Apache Tomcat/8.0.50 logs.
보니까 DB연결에 문제가 있는것 같다.
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'discussadmin'@'183.111.138.246' (using password: YES)) ### The error may exist in file [/discussadmin/tomcat/webapps/discuss/WEB-INF/classes/mapper/mysql/user.xml]
원인 : jdbc연결예외 : JDBC 연결을 찾을수가 없다.
이 에러는 user.xml 에서 존재하는것으로 보인다.
이틀동안 총 9번의 war Export 및 테스트 결과 드디어 성공했다.
문제는 context-datasource.xml 에 있었다!
해결법
원래 globals.properties 로 다른 문서에 설정해둔 DB 연결값을 context-datasource.xml에 가져와서 매핑하는 식으로 했었으나 context-datasource.xml 에 직접 기술하는 방법으로 바꿨다.
즉 context-datasource.xml 에 이렇게 기술한다. 제일 중요한건 url 값의 아이피에 꼭 localhost 라고 적고 war Export를 해야한다는 점이다. 계속 카페24 도메인을 넣고 테스트를 했었는데 localhost를 넣자마자 바로 성공 했다.
<!-- mysql --> <bean id="dataSource-mysql" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/데이터베이스 아이디" /> <property name="username" value="데이터베이스 아이디"/> <property name="password" value="데이터베이스 비밀번호"/> <property name="validationQuery" value="select 1"/> <property name="testOnBorrow" value="true"/> </bean>
'BACK-END > Spring' 카테고리의 다른 글
[Spring] 디스커스 개발 : 화면 UI 재설계 (0) 2021.01.14 [Spring] 스프링 프로젝트 로그 관리 (0) 2021.01.13 [Spring] 컨트롤러에서 컨트롤러로 값이동 (0) 2020.12.28 [Spring] 카페24를 이용한 호스팅 연습 (0) 2020.12.26 [Spring] Ajax 회원가입 구현 (0) 2020.12.23