From 009a006ea8dcaf63538aa671bb02978e257d86c8 Mon Sep 17 00:00:00 2001 From: ArtemEmelyanov Date: Wed, 24 May 2023 23:02:28 +0400 Subject: [PATCH] =?UTF-8?q?MVC=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data.mv.db | Bin 45056 -> 40960 bytes data.trace.db | 645 ++++++++++++++++++ .../Contoller/MVC/GroupMvcController.java | 11 +- .../Contoller/MVC/StudentMvcController.java | 11 +- .../Contoller/MVC/SubjectMvcController.java | 11 +- .../IP/University/Service/GroupService.java | 19 +- .../IP/University/Service/StudentService.java | 19 +- .../IP/University/Service/SubjectService.java | 18 +- src/main/resources/templates/default.html | 1 + src/main/resources/templates/error.html | 13 + src/main/resources/templates/group.html | 8 +- src/main/resources/templates/student.html | 8 +- src/main/resources/templates/subject.html | 8 +- 13 files changed, 745 insertions(+), 27 deletions(-) create mode 100644 src/main/resources/templates/error.html diff --git a/data.mv.db b/data.mv.db index 493b1b18db59abd46995ce785d667d6371f50172..b9aaf01f8d86fba3e706de199a5c8cd142ee90c3 100644 GIT binary patch literal 40960 zcmeHQ?Qa`LdS6nM%_vdq*iJ5&%U#xt5?gl+vopK1FKl}aUnNQuCGkbJ0<^^La@JNX zk%~n5?4U)1qCh`izuf_c;tI51dIegv{Z<@|qF)Zh0ZKm{aGwr`q92R?3w`#DTrRm3 z6-!PI7{T71*`1eXe)H_??EL0=xSGXjW4~uU%F6D!vG*CxB0&(+=EIZjqpYN*&3&qO zvnXvIQN2$)S){6xren(z#I)5rI?(%2$YXkRyw~g6>8*X*Hy_fYEKxhME@ORxV}A?* zh5$o=A;1t|2rvW~0t^9$07HNwzz|>ve1!r$**{u0C0Mrc40~2KtIfiDx98Vktqr3E`8F^O6f!W0X>HEQLop} zB4olg0YRc7lG6RX1DYiY)#Q#e+zX(j`#m#@6j9|b=nu9M-1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`c+QT1Gk!Y&r6~Ea=Q;#60T=B)oDI6UcFX&yDAixqh-@@M|@T74 zl`C%H@D~Mkb~U8nFOgh4ZF0f1OK!#srd@WEE|_)&(k`7L?Q)WfsH3M~_2J;jxpeEo zYxR$kA&y`Ix&ga!=+Js01b)Lfyjz3~4`5pa=g1jY&Rw^4pGj30d8iK;k)Z)`{=MQs zp?`kmmtV1EGgluhyliIWv()dGUUq957Ms@Fr-p4!6T78N%-$XD(1gXNg`I}j)--uK z++|zSgtw;gW794@c=cDyv#6VZv7ywBc^2yCU+L_AT#(w>^@HaMQ49O6z@9ZTwuTAq zSu- z5JmUwyX*X=zq<}BcTE0d!&~l{{Exqaq1?kn^4EUU-KFn$g18)WoCr=?tv=fwg{}Xe z<3?}_qJjG?TmK*HLvXJ3|BU}1T2J%QNar)&$L9)je*P8mjQ@`bF2MMIx?|s>ehyxE zTekimdV2Q95MT%}1Q-Gg0fxYZB0%{6fPW8>=mGyPim?3OHZO!ipU8yr|Is~yL;U}E zFQ5f?10FxXc(dP$5?}5D`2VH2Tw#`8%MC6W-$s`|wQpjaz}=c;MC(@*79|OHVMu3pM+?=le3l z#l-a$VEq3qzaYl{e<5Kr8UOD*&tcWy8+LDC!_&?wcB91;S8Q)uwm0pQ9L`!tVH^uGUEUJAA6o~-v9sr diff --git a/data.trace.db b/data.trace.db index b34a08a..ed9ed18 100644 --- a/data.trace.db +++ b/data.trace.db @@ -12037,3 +12037,648 @@ alter table if exists subjects add constraint FKm9k2q12kousqip4g5spqrm2am foreig at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) +2023-05-23 21:58:11 jdbc[3]: exception +org.h2.jdbc.JdbcSQLNonTransientConnectionException: База данных уже закрыта (чтобы отключить автоматическое закрытие базы данных при останове JVM, добавьте ";DB_CLOSE_ON_EXIT=FALSE" в URL) +Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:697) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + at org.h2.message.DbException.get(DbException.java:227) + at org.h2.message.DbException.get(DbException.java:203) + at org.h2.message.DbException.get(DbException.java:192) + at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1375) + at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:1041) + at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:334) + at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java) + at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$2.doPrepare(StatementPreparerImpl.java:109) + at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:176) + at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:111) + at org.hibernate.dialect.identity.GetGeneratedKeysDelegate.prepare(GetGeneratedKeysDelegate.java:51) + at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:39) + at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3327) + at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3965) + at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:80) + at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:653) + at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:283) + at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:264) + at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:322) + at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:340) + at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:286) + at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:192) + at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122) + at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:184) + at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:129) + at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:53) + at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107) + at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:737) + at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:721) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360) + at jdk.proxy4/jdk.proxy4.$Proxy122.persist(Unknown Source) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:307) + at jdk.proxy4/jdk.proxy4.$Proxy122.persist(Unknown Source) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:610) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:288) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:136) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:120) + at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516) + at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) + at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:168) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:77) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) + at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) + at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:163) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:218) + at jdk.proxy4/jdk.proxy4.$Proxy134.save(Unknown Source) + at ru.IP_LabWorks.IP.University.Service.StudentService.addStudent(StudentService.java:46) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) + at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) + at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752) + at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) + at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) + at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752) + at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) + at ru.IP_LabWorks.IP.University.Service.StudentService$$SpringCGLIB$$0.addStudent() + at ru.IP_LabWorks.IP.University.Contoller.MVC.StudentMvcController.saveStudent(StudentMvcController.java:60) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207) + at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:152) + at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:884) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) + at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1080) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) + at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:731) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:66) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365) + at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) + at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:82) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:69) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233) + at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191) + at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:351) + at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) + at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) + at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.base/java.lang.Thread.run(Thread.java:833) +2023-05-23 21:58:11 jdbc[3]: exception +org.h2.jdbc.JdbcSQLNonTransientConnectionException: База данных уже закрыта (чтобы отключить автоматическое закрытие базы данных при останове JVM, добавьте ";DB_CLOSE_ON_EXIT=FALSE" в URL) +Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:697) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + at org.h2.message.DbException.get(DbException.java:227) + at org.h2.message.DbException.get(DbException.java:203) + at org.h2.message.DbException.get(DbException.java:192) + at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1375) + at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:463) + at com.zaxxer.hikari.pool.ProxyConnection.rollback(ProxyConnection.java:385) + at com.zaxxer.hikari.pool.HikariProxyConnection.rollback(HikariProxyConnection.java) + at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.rollback(AbstractLogicalConnectionImplementor.java:121) + at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.rollback(JdbcResourceLocalTransactionCoordinatorImpl.java:304) + at org.hibernate.engine.transaction.internal.TransactionImpl.rollback(TransactionImpl.java:142) + at org.springframework.orm.jpa.JpaTransactionManager.doRollback(JpaTransactionManager.java:589) + at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:835) + at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:809) + at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:672) + at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:392) + at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) + at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752) + at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) + at ru.IP_LabWorks.IP.University.Service.StudentService$$SpringCGLIB$$0.addStudent() + at ru.IP_LabWorks.IP.University.Contoller.MVC.StudentMvcController.saveStudent(StudentMvcController.java:60) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207) + at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:152) + at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:884) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) + at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1080) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) + at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:731) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:66) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365) + at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) + at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:82) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:69) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233) + at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191) + at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:351) + at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) + at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) + at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.base/java.lang.Thread.run(Thread.java:833) +2023-05-23 21:58:11 jdbc[3]: exception +org.h2.jdbc.JdbcSQLNonTransientConnectionException: База данных уже закрыта (чтобы отключить автоматическое закрытие базы данных при останове JVM, добавьте ";DB_CLOSE_ON_EXIT=FALSE" в URL) +Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:697) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + at org.h2.message.DbException.get(DbException.java:227) + at org.h2.message.DbException.get(DbException.java:203) + at org.h2.message.DbException.get(DbException.java:192) + at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1375) + at org.h2.jdbc.JdbcConnection.getWarnings(JdbcConnection.java:596) + at com.zaxxer.hikari.pool.HikariProxyConnection.getWarnings(HikariProxyConnection.java) + at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.handleAndClearWarnings(SqlExceptionHelper.java:286) + at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logAndClearWarnings(SqlExceptionHelper.java:265) + at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.releaseConnection(LogicalConnectionManagedImpl.java:214) + at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.close(LogicalConnectionManagedImpl.java:252) + at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:170) + at org.hibernate.internal.AbstractSharedSessionContract.close(AbstractSharedSessionContract.java:376) + at org.hibernate.internal.SessionImpl.closeWithoutOpenChecks(SessionImpl.java:404) + at org.hibernate.internal.SessionImpl.close(SessionImpl.java:389) + at jdk.internal.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360) + at jdk.proxy4/jdk.proxy4.$Proxy122.close(Unknown Source) + at org.springframework.orm.jpa.EntityManagerFactoryUtils.closeEntityManager(EntityManagerFactoryUtils.java:424) + at org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor.afterCompletion(OpenEntityManagerInViewInterceptor.java:112) + at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.afterCompletion(WebRequestHandlerInterceptorAdapter.java:73) + at org.springframework.web.servlet.HandlerExecutionChain.triggerAfterCompletion(HandlerExecutionChain.java:176) + at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletion(DispatcherServlet.java:1468) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1100) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) + at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:731) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:66) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365) + at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) + at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:82) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:69) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233) + at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191) + at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:351) + at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) + at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) + at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.base/java.lang.Thread.run(Thread.java:833) +2023-05-23 21:58:11 jdbc[3]: exception +org.h2.jdbc.JdbcSQLNonTransientConnectionException: База данных уже закрыта (чтобы отключить автоматическое закрытие базы данных при останове JVM, добавьте ";DB_CLOSE_ON_EXIT=FALSE" в URL) +Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:697) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + at org.h2.message.DbException.get(DbException.java:227) + at org.h2.message.DbException.get(DbException.java:203) + at org.h2.message.DbException.get(DbException.java:192) + at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1375) + at org.h2.jdbc.JdbcConnection.clearWarnings(JdbcConnection.java:610) + at com.zaxxer.hikari.pool.HikariProxyConnection.clearWarnings(HikariProxyConnection.java) + at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.handleAndClearWarnings(SqlExceptionHelper.java:295) + at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logAndClearWarnings(SqlExceptionHelper.java:265) + at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.releaseConnection(LogicalConnectionManagedImpl.java:214) + at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.close(LogicalConnectionManagedImpl.java:252) + at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:170) + at org.hibernate.internal.AbstractSharedSessionContract.close(AbstractSharedSessionContract.java:376) + at org.hibernate.internal.SessionImpl.closeWithoutOpenChecks(SessionImpl.java:404) + at org.hibernate.internal.SessionImpl.close(SessionImpl.java:389) + at jdk.internal.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360) + at jdk.proxy4/jdk.proxy4.$Proxy122.close(Unknown Source) + at org.springframework.orm.jpa.EntityManagerFactoryUtils.closeEntityManager(EntityManagerFactoryUtils.java:424) + at org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor.afterCompletion(OpenEntityManagerInViewInterceptor.java:112) + at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.afterCompletion(WebRequestHandlerInterceptorAdapter.java:73) + at org.springframework.web.servlet.HandlerExecutionChain.triggerAfterCompletion(HandlerExecutionChain.java:176) + at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletion(DispatcherServlet.java:1468) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1100) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) + at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:731) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:66) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365) + at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) + at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:82) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:69) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233) + at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191) + at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:351) + at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) + at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) + at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.base/java.lang.Thread.run(Thread.java:833) +2023-05-23 21:58:11 jdbc[3]: exception +org.h2.jdbc.JdbcSQLNonTransientConnectionException: База данных уже закрыта (чтобы отключить автоматическое закрытие базы данных при останове JVM, добавьте ";DB_CLOSE_ON_EXIT=FALSE" в URL) +Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:697) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + at org.h2.message.DbException.get(DbException.java:227) + at org.h2.message.DbException.get(DbException.java:203) + at org.h2.message.DbException.get(DbException.java:192) + at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1375) + at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:463) + at com.zaxxer.hikari.pool.ProxyConnection.close(ProxyConnection.java:249) + at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.closeConnection(DatasourceConnectionProviderImpl.java:127) + at org.hibernate.internal.NonContextualJdbcConnectionAccess.releaseConnection(NonContextualJdbcConnectionAccess.java:49) + at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.releaseConnection(LogicalConnectionManagedImpl.java:218) + at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.close(LogicalConnectionManagedImpl.java:252) + at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:170) + at org.hibernate.internal.AbstractSharedSessionContract.close(AbstractSharedSessionContract.java:376) + at org.hibernate.internal.SessionImpl.closeWithoutOpenChecks(SessionImpl.java:404) + at org.hibernate.internal.SessionImpl.close(SessionImpl.java:389) + at jdk.internal.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:568) + at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360) + at jdk.proxy4/jdk.proxy4.$Proxy122.close(Unknown Source) + at org.springframework.orm.jpa.EntityManagerFactoryUtils.closeEntityManager(EntityManagerFactoryUtils.java:424) + at org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor.afterCompletion(OpenEntityManagerInViewInterceptor.java:112) + at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.afterCompletion(WebRequestHandlerInterceptorAdapter.java:73) + at org.springframework.web.servlet.HandlerExecutionChain.triggerAfterCompletion(HandlerExecutionChain.java:176) + at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletion(DispatcherServlet.java:1468) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1100) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) + at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:731) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) + at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:66) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365) + at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) + at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) + at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) + at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) + at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:82) + at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:69) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) + at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233) + at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191) + at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:351) + at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) + at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) + at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.base/java.lang.Thread.run(Thread.java:833) diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/GroupMvcController.java b/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/GroupMvcController.java index b4fdfa5..6dd1b07 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/GroupMvcController.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/GroupMvcController.java @@ -1,6 +1,7 @@ package ru.IP_LabWorks.IP.University.Contoller.MVC; import jakarta.validation.Valid; +import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; @@ -28,19 +29,25 @@ public class GroupMvcController { } @GetMapping - public String getGroups(Model model) { + public String getGroups(Model model, Authentication authentication) { model.addAttribute("groups", groupService.findAllGroups().stream() .map(GroupDTO::new) .toList()); + boolean isAdmin = authentication.getAuthorities().stream() + .anyMatch(authority -> authority.getAuthority().equals("ROLE_ADMIN")); + model.addAttribute("isAdmin", isAdmin); return "group"; } @GetMapping(value = {"/edit", "/edit/{id}"}) public String editGroup(@PathVariable(required = false) Long id, - Model model) { + Model model, Authentication authentication) { if (id == null || id <= 0) { model.addAttribute("groupDTO", new GroupDTO()); + boolean isAdmin = authentication.getAuthorities().stream() + .anyMatch(authority -> authority.getAuthority().equals("ROLE_ADMIN")); + model.addAttribute("isAdmin", isAdmin); } else { model.addAttribute("groupId", id); model.addAttribute("groupDTO", new GroupDTO(groupService.findGroup(id))); diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/StudentMvcController.java b/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/StudentMvcController.java index d82a144..0997a3a 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/StudentMvcController.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/StudentMvcController.java @@ -1,6 +1,7 @@ package ru.IP_LabWorks.IP.University.Contoller.MVC; import jakarta.validation.Valid; +import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; @@ -26,20 +27,26 @@ public class StudentMvcController { } @GetMapping - public String getStudents(Model model) { + public String getStudents(Model model, Authentication authentication) { model.addAttribute("students", studentService.findAllStudents().stream() .map(StudentDTO::new) .toList()); + boolean isAdmin = authentication.getAuthorities().stream() + .anyMatch(authority -> authority.getAuthority().equals("ROLE_ADMIN")); + model.addAttribute("isAdmin", isAdmin); return "student"; } @GetMapping(value = {"/edit", "/edit/{id}"}) public String editStudent(@PathVariable(required = false) Long id, - Model model) { + Model model, Authentication authentication) { model.addAttribute("Groups", groupService.findAllGroups()); if (id == null || id <= 0) { model.addAttribute("studentDTO", new StudentDTO()); + boolean isAdmin = authentication.getAuthorities().stream() + .anyMatch(authority -> authority.getAuthority().equals("ROLE_ADMIN")); + model.addAttribute("isAdmin", isAdmin); } else { model.addAttribute("studentId", id); model.addAttribute("studentDTO", new StudentDTO(studentService.findStudent(id))); diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/SubjectMvcController.java b/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/SubjectMvcController.java index 9de8ef4..b7ee287 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/SubjectMvcController.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Contoller/MVC/SubjectMvcController.java @@ -1,6 +1,7 @@ package ru.IP_LabWorks.IP.University.Contoller.MVC; import jakarta.validation.Valid; +import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; @@ -25,19 +26,25 @@ public class SubjectMvcController { } @GetMapping - public String getSubjects(Model model) { + public String getSubjects(Model model, Authentication authentication) { model.addAttribute("subjects", subjectService.findAllSubjects().stream() .map(SubjectDTO::new) .toList()); + boolean isAdmin = authentication.getAuthorities().stream() + .anyMatch(authority -> authority.getAuthority().equals("ROLE_ADMIN")); + model.addAttribute("isAdmin", isAdmin); return "subject"; } @GetMapping(value = {"/edit", "/edit/{id}"}) public String editSubject(@PathVariable(required = false) Long id, - Model model) { + Model model, Authentication authentication) { if (id == null || id <= 0) { model.addAttribute("subjectDTO", new SubjectDTO()); + boolean isAdmin = authentication.getAuthorities().stream() + .anyMatch(authority -> authority.getAuthority().equals("ROLE_ADMIN")); + model.addAttribute("isAdmin", isAdmin); } else { model.addAttribute("subjectId", id); model.addAttribute("subjectDTO", new SubjectDTO(subjectService.findSubject(id))); diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java b/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java index abe56eb..c3d197d 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java @@ -1,12 +1,12 @@ package ru.IP_LabWorks.IP.University.Service; import org.springframework.context.annotation.Lazy; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import ru.IP_LabWorks.IP.University.Model.Group; -import ru.IP_LabWorks.IP.University.Model.Student; -import ru.IP_LabWorks.IP.University.Model.Subject; +import ru.IP_LabWorks.IP.University.Model.*; import ru.IP_LabWorks.IP.University.Repository.GroupRepository; import ru.IP_LabWorks.IP.University.Service.NotFoundException.GroupNotFoundException; @@ -23,10 +23,13 @@ public class GroupService { private final StudentService studentService; private final SubjectService subjectService; - public GroupService(GroupRepository groupRepository, StudentService studentService, @Lazy SubjectService subjectService) { + private final UserService userService; + + public GroupService(GroupRepository groupRepository, StudentService studentService, @Lazy SubjectService subjectService, UserService userService) { this.groupRepository = groupRepository; this.studentService = studentService; this.subjectService = subjectService; + this.userService = userService; } @Transactional @@ -35,6 +38,14 @@ public class GroupService { throw new IllegalArgumentException("Group name is null or empty"); } final Group group = new Group(name); + Object currentUser = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + if(currentUser instanceof UserDetails){ + String username = ((UserDetails)currentUser).getUsername(); + User user = userService.findByLogin(username); + if(user.getRole() == UserRole.ADMIN){ + group.setUser(user); + } + } return groupRepository.save(group); } diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Service/StudentService.java b/src/main/java/ru/IP_LabWorks/IP/University/Service/StudentService.java index 4368434..cd8724e 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Service/StudentService.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Service/StudentService.java @@ -1,12 +1,14 @@ package ru.IP_LabWorks.IP.University.Service; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import ru.IP_LabWorks.IP.University.Model.Group; import ru.IP_LabWorks.IP.University.Model.Student; +import ru.IP_LabWorks.IP.University.Model.User; +import ru.IP_LabWorks.IP.University.Model.UserRole; import ru.IP_LabWorks.IP.University.Repository.StudentRepository; import ru.IP_LabWorks.IP.University.Service.NotFoundException.StudentNotFoundException; @@ -19,9 +21,12 @@ public class StudentService { private final StudentRepository studentRepository; private final GroupService groupService; - public StudentService(StudentRepository studentRepository,@Lazy GroupService groupService) { + private final UserService userService; + + public StudentService(StudentRepository studentRepository, @Lazy GroupService groupService, UserService userService) { this.studentRepository = studentRepository; this.groupService = groupService; + this.userService = userService; } @Transactional @@ -30,6 +35,14 @@ public class StudentService { throw new IllegalArgumentException("Student name or date is null or empty"); } final Student student = new Student(name, birthDate); + Object currentUser = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + if(currentUser instanceof UserDetails){ + String username = ((UserDetails)currentUser).getUsername(); + User user = userService.findByLogin(username); + if(user.getRole() == UserRole.ADMIN){ + student.setUser(user); + } + } return studentRepository.save(student); } diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java b/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java index d58d7a4..d0337d0 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java @@ -1,10 +1,13 @@ package ru.IP_LabWorks.IP.University.Service; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; -import ru.IP_LabWorks.IP.University.Model.Group; import ru.IP_LabWorks.IP.University.Model.Subject; +import ru.IP_LabWorks.IP.University.Model.User; +import ru.IP_LabWorks.IP.University.Model.UserRole; import ru.IP_LabWorks.IP.University.Repository.SubjectRepository; import ru.IP_LabWorks.IP.University.Service.NotFoundException.SubjectNotFoundException; @@ -17,9 +20,12 @@ public class SubjectService { private final SubjectRepository subjectRepository; private final GroupService groupService; - public SubjectService(SubjectRepository subjectRepository, GroupService groupService) { + private final UserService userService; + + public SubjectService(SubjectRepository subjectRepository, GroupService groupService, UserService userService) { this.subjectRepository = subjectRepository; this.groupService = groupService; + this.userService = userService; } @Transactional @@ -28,6 +34,14 @@ public class SubjectService { throw new IllegalArgumentException("Subject name is null or empty"); } final Subject subject = new Subject(name); + Object currentUser = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + if(currentUser instanceof UserDetails){ + String username = ((UserDetails)currentUser).getUsername(); + User user = userService.findByLogin(username); + if(user.getRole() == UserRole.ADMIN){ + subject.setUser(user); + } + } return subjectRepository.save(subject); } diff --git a/src/main/resources/templates/default.html b/src/main/resources/templates/default.html index 3c6930f..47e6785 100644 --- a/src/main/resources/templates/default.html +++ b/src/main/resources/templates/default.html @@ -26,6 +26,7 @@ Группы Предметы Пользователи + Выход diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html new file mode 100644 index 0000000..0032787 --- /dev/null +++ b/src/main/resources/templates/error.html @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/group.html b/src/main/resources/templates/group.html index cde2bb9..acbf354 100644 --- a/src/main/resources/templates/group.html +++ b/src/main/resources/templates/group.html @@ -7,7 +7,7 @@

Group Table

+ th:href="@{/group/edit}" th:if="${isAdmin}"> Добавить
+ th:href="@{/group/edit/{id}(id=${group.id})}" th:if="${isAdmin}"> Изменить Посмотреть предметы
-
+ diff --git a/src/main/resources/templates/student.html b/src/main/resources/templates/student.html index a1db693..e69c583 100644 --- a/src/main/resources/templates/student.html +++ b/src/main/resources/templates/student.html @@ -9,7 +9,7 @@

Student Table

@@ -31,15 +31,15 @@
+ th:href="@{/student/edit/{id}(id=${student.id})}" th:if="${isAdmin}"> Изменить
- + diff --git a/src/main/resources/templates/subject.html b/src/main/resources/templates/subject.html index bd73278..96d53e7 100644 --- a/src/main/resources/templates/subject.html +++ b/src/main/resources/templates/subject.html @@ -7,7 +7,7 @@

Subject Table

@@ -25,15 +25,15 @@
+ th:href="@{/subject/edit/{id}(id=${subject.id})}" th:if="${isAdmin}"> Изменить
- +