axboot / ax-boot-framework

Full Stack Java Web Application Framework with Java & HTML5
http://www.axboot.com
MIT License
242 stars 70 forks source link

SlowQuery Detector #15

Closed jsw418jj closed 8 years ago

jsw418jj commented 8 years ago

db를 h2에서 oracle로 변경해서 사용중입니다.

https://api.axboot.com/composition/slowquery-detector.html 여기를 참고하면

지정된 시간보다 더 오래동안 쿼리가 수행될 경우 에러로그로 해당 쿼리정보를 기록합니다.

라고 하는데 현재 서버를 빌드 할때만다 ERROR_LOG_M 테이블에 계속 데이터가 인설트 됩니다. 에러가 발생했을때만 나는것이 아니라 페이지 호출하는 동안에도 계속 등록이 되는데 지정시간을 설정하는 곳이 axboot-local.properties 인가요??

2016-11-02 17:41:14 [http-nio-7777-exec-6] DEBUG org.springframework.web.servlet.DispatcherServlet:render:1251 Rendering view [com.chequer.axboot.core.json.ContentTypeSwitchableMappingJackson2JsonView: unnamed] in DispatcherServlet with name 'dispatcherServlet'
2016-11-02 17:41:14 [http-nio-7777-exec-6] INFO  com.chequer.axboot.core.db.aop.StatementMethodInterceptor:invoke:149 
[query] - 2016-11-02 17:41:14 - 
    select
        SEQ_ERROR_LOG_M.nextval 
    from
        dual

2016-11-02 17:41:14 [http-nio-7777-exec-6] INFO  com.chequer.axboot.core.db.aop.StatementMethodInterceptor:invoke:149 
[query] - 2016-11-02 17:41:14 - 
    insert 
    into
        ERROR_LOG_M
        (ALERT_YN, ERROR_DATETIME, HEADER_MAP, HOST_NAME, LOGGER_NAME, MESSAGE, PARAMETER_MAP, PATH, PHASE, SERVER_NAME, SYSTEM, USER_INFO, ID) 
    values
        ('N', to_timestamp('2016/11/02 17:41:14.037', 'yyyy/mm/dd hh24:mi:ss.ff3'), '{"referer":"http://localhost:7777/jsp/system/system-auth-user.jsp?menuId=5","accept-language":"ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4","cookie":"JSESSIONID=208A52A12E010EC58EF93E64C9D484AB; c4689008-aa87-451c-bb15-a0ff8a411770=eyJ1c2VyQ2QiOiJzeXN0ZW0iLCJ1c2VyUHMiOiIkMmEkMTEkcnVWa29pZUNQZ2hOT0E2bXRLeldSZVo1RWU2NmhiZXF3dmxCVDF6Llc0Vk1ZY2tCbGQ2dUMiLCJ1c2VyTm0iOiLsi5zsiqTthZwg6rSA66as7J6QIiwibG9jYWxlIjoia29fS1IiLCJ0aW1lWm9uZSI6IkFzaWEvU2VvdWwiLCJtZW51R3JwQ2QiOiJTWVNURU1fTUFOQUdFUiIsImRhdGVGb3JtYXQiOiJ5eXl5LU1NLWRkIiwiZGF0ZVRpbWVGb3JtYXQiOm51bGwsInRpbWVGb3JtYXQiOiJISDptbTpzcyIsIm1lbnVIYXNoIjpudWxsLCJleHBpcmVzIjowLCJkZXRhaWxzIjp7fSwiYXV0aG9yaXR5TGlzdCI6WyJST0xFX0FTUF9BQ0NFU1MiLCJST0xFX1NZU1RFTV9NQU5BR0VSIl0sImF1dGhHcm91cExpc3QiOlsiUzAwMDEiXX0=.fhxhCRvXNcPshu21sWGGZ4bzLYJvIfenD8vZoPV7deg=","host":"localhost:7777","x-requested-with":"XMLHttpRequest","connection":"keep-alive","content-type":"application/json","accept-encoding":"gzip, deflate, sdch, br","accept":"*/*","user-agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"}', 'sw-PC', 'org.springframework.web.servlet.DispatcherServlet', 'Rendering view [com.chequer.axboot.core.json.ContentTypeSwitchableMappingJackson2JsonView: unnamed] in DispatcherServlet with name 'dispatcherServlet'', '"{\"useYn\":\"Y\",\"groupCd\":\"USER_ROLE\"}"', '/api/v1/commonCodes', 'local', 'localhost', 'AXBOOT', '{"sessionUser":{"userCd":"system","userPs":null,"userNm":"시스템 관리자","locale":"ko_KR","timeZone":"Asia/Seoul","menuGrpCd":"SYSTEM_MANAGER","dateFormat":"yyyy-MM-dd","dateTimeFormat":null,"timeFormat":"HH:mm:ss","menuHash":null,"expires":0,"details":{},"authorityList":["ROLE_ASP_ACCESS","ROLE_SYSTEM_MANAGER"],"authGroupList":["S0001"]},"userAgent":{"operatingSystem":"WINDOWS_7","browser":"CHROME","id":34934529,"browserVersion":{"version":"54.0.2840.71","majorVersion":"54","minorVersion":"0"}},"browserType":"WEB_BROWSER","renderingEngine":"WEBKIT","deviceType":"COMPUTER","manufacturer":"MICROSOFT"}', 14917)

2016-11-02 17:41:14 [http-nio-7777-exec-6] DEBUG org.springframework.web.servlet.DispatcherServlet:processRequest:1000 Successfully completed request
2016-11-02 17:41:14 [http-nio-7777-exec-6] INFO  com.chequer.axboot.core.db.aop.StatementMethodInterceptor:invoke:149 
[query] - 2016-11-02 17:41:14 - 
    select
        SEQ_ERROR_LOG_M.nextval 
    from
        dual

2016-11-02 17:41:14 [http-nio-7777-exec-6] INFO  com.chequer.axboot.core.db.aop.StatementMethodInterceptor:invoke:149 
[query] - 2016-11-02 17:41:14 - 
    insert 
    into
        ERROR_LOG_M
        (ALERT_YN, ERROR_DATETIME, HEADER_MAP, HOST_NAME, LOGGER_NAME, MESSAGE, PARAMETER_MAP, PATH, PHASE, SERVER_NAME, SYSTEM, USER_INFO, ID) 
    values
        ('N', to_timestamp('2016/11/02 17:41:14.050', 'yyyy/mm/dd hh24:mi:ss.ff3'), '{"referer":"http://localhost:7777/jsp/system/system-auth-user.jsp?menuId=5","accept-language":"ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4","cookie":"JSESSIONID=208A52A12E010EC58EF93E64C9D484AB; c4689008-aa87-451c-bb15-a0ff8a411770=eyJ1c2VyQ2QiOiJzeXN0ZW0iLCJ1c2VyUHMiOiIkMmEkMTEkcnVWa29pZUNQZ2hOT0E2bXRLeldSZVo1RWU2NmhiZXF3dmxCVDF6Llc0Vk1ZY2tCbGQ2dUMiLCJ1c2VyTm0iOiLsi5zsiqTthZwg6rSA66as7J6QIiwibG9jYWxlIjoia29fS1IiLCJ0aW1lWm9uZSI6IkFzaWEvU2VvdWwiLCJtZW51R3JwQ2QiOiJTWVNURU1fTUFOQUdFUiIsImRhdGVGb3JtYXQiOiJ5eXl5LU1NLWRkIiwiZGF0ZVRpbWVGb3JtYXQiOm51bGwsInRpbWVGb3JtYXQiOiJISDptbTpzcyIsIm1lbnVIYXNoIjpudWxsLCJleHBpcmVzIjowLCJkZXRhaWxzIjp7fSwiYXV0aG9yaXR5TGlzdCI6WyJST0xFX0FTUF9BQ0NFU1MiLCJST0xFX1NZU1RFTV9NQU5BR0VSIl0sImF1dGhHcm91cExpc3QiOlsiUzAwMDEiXX0=.fhxhCRvXNcPshu21sWGGZ4bzLYJvIfenD8vZoPV7deg=","host":"localhost:7777","x-requested-with":"XMLHttpRequest","connection":"keep-alive","content-type":"application/json","accept-encoding":"gzip, deflate, sdch, br","accept":"*/*","user-agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"}', 'sw-PC', 'org.springframework.web.servlet.DispatcherServlet', 'Successfully completed request', '"{\"useYn\":\"Y\",\"groupCd\":\"USER_ROLE\"}"', '/api/v1/commonCodes', 'local', 'localhost', 'AXBOOT', '{"sessionUser":{"userCd":"system","userPs":null,"userNm":"시스템 관리자","locale":"ko_KR","timeZone":"Asia/Seoul","menuGrpCd":"SYSTEM_MANAGER","dateFormat":"yyyy-MM-dd","dateTimeFormat":null,"timeFormat":"HH:mm:ss","menuHash":null,"expires":0,"details":{},"authorityList":["ROLE_ASP_ACCESS","ROLE_SYSTEM_MANAGER"],"authGroupList":["S0001"]},"userAgent":{"operatingSystem":"WINDOWS_7","browser":"CHROME","id":34934529,"browserVersion":{"version":"54.0.2840.71","majorVersion":"54","minorVersion":"0"}},"browserType":"WEB_BROWSER","renderingEngine":"WEBKIT","deviceType":"COMPUTER","manufacturer":"MICROSOFT"}', 14918)

이렇게 페이지 호출이나 빌드 할때마다 몇십개씩 등록이 됩니다.

brant-hwang commented 8 years ago

SlowQuery가 아니라 로직에서 에러가 발생하고 있는것같습니다. StackTrace를 올려주시면 도와드릴 수 있을것같네요.

jsw418jj commented 8 years ago

현재 db를 h2에서 oracle로 변경하고 spring-boot:run을 사용하기 위해 포트 변경이 필요해서 application.properties만 추가해서 사용중입니다. 그외에는 설치하기에서 나와있는 initialazr에서 생성된 소스를 그대로 사용중입니다.

서버를 빌드하면 말씀하신 StrackTrace없이 위에 로그가 남겨진 대로 계속 인설트만 됩니다. 그리고 지금은 메뉴를 클릭하면

ERROR com.chequer.axboot.core.controllers.BaseController:errorLogging:97 결과 집합을 종료했음: next
java.sql.SQLException: 결과 집합을 종료했음: next
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:175)
    at org.apache.commons.dbcp2.DelegatingResultSet.next(DelegatingResultSet.java:191)
    at org.apache.commons.dbcp2.DelegatingResultSet.next(DelegatingResultSet.java:191)
    at org.hibernate.loader.Loader.processResultSet(Loader.java:968)
    at org.hibernate.loader.Loader.doQuery(Loader.java:930)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
    at org.hibernate.loader.Loader.doList(Loader.java:2617)
    at org.hibernate.loader.Loader.doList(Loader.java:2600)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429)
    at org.hibernate.loader.Loader.list(Loader.java:2424)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1326)
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
    at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
    at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483)
    at com.querydsl.jpa.impl.AbstractJPAQuery.getResultList(AbstractJPAQuery.java:160)
    at com.querydsl.jpa.impl.AbstractJPAQuery.fetch(AbstractJPAQuery.java:202)
    at com.gaubiz.domain.code.CommonCodeService.get(CommonCodeService.java:41)
    at com.gaubiz.domain.code.CommonCodeService$$FastClassBySpringCGLIB$$3cfe24dd.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
    at com.gaubiz.domain.code.CommonCodeService$$EnhancerBySpringCGLIB$$bd8b81b8.get(<generated>)
    at com.gaubiz.controllers.CommonCodeController.list(CommonCodeController.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.chequer.axboot.core.filters.AXBootConfigFilter.doFilter(AXBootConfigFilter.java:31)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.chequer.axboot.core.filters.AXBootCorsFilter.doFilter(AXBootCorsFilter.java:17)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at com.chequer.axboot.core.filters.AXBootLogbackMdcFilter.doFilter(AXBootLogbackMdcFilter.java:31)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at com.gaubiz.security.AXBootAuthenticationFilter.doFilter(AXBootAuthenticationFilter.java:33)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.chequer.axboot.core.filters.MultiReadableHttpServletRequestFilter.doFilter(MultiReadableHttpServletRequestFilter.java:15)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:108)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

이런 에러가 발생합니다,

추가 질문

설치하기에서 npm으로 install을 하라고 하셨는데 install을 하게 되면 npm오류가 발생합니다. 윈도우7 64bit, eclipse를 사용하는데 이것에서는 install이 안되서 수동으로 js를 설치해서 소스를 구동중입니다. 윈도우 환경에서는 npm install오류가 발생하는 이유가 있나요??

brant-hwang commented 8 years ago

오라클 테이블 데이터 타입이 엔티티와 일치하지 않는 오류인것같네요. JPA / Hibernate와 Oracle 간의 엔티티와 데이터베이스 설정부분을 더 살펴보셔야할 것 같습니다.

현재 AXBoot는 H2, MySQL(MariaDB)에서만 테스트 되었고, 오라클은 테스트 대상 데이터베이스가 아닌관계로 추후 업데이트 될 예정입니다.

jsw418jj commented 8 years ago

네 감사합니다. 잘 확인하겠습니다.