diff --git a/backend/ipLab/data.mv.db b/backend/ipLab/data.mv.db index cd412bd..cac197a 100644 Binary files a/backend/ipLab/data.mv.db and b/backend/ipLab/data.mv.db differ diff --git a/backend/ipLab/data.trace.db b/backend/ipLab/data.trace.db index 6f14cbf..1570137 100644 --- a/backend/ipLab/data.trace.db +++ b/backend/ipLab/data.trace.db @@ -5074,3 +5074,635 @@ SELECT * FROM Product p WHERE p.store_fk == null [42001-210] org.h2.jdbc.JdbcSQLSyntaxErrorException: Синтаксическая ошибка в выражении SQL "SELECT * FROM Product p WHERE p.store_fk =[*]= null"; ожидалось "ALL, ANY, SOME" Syntax error in SQL statement "SELECT * FROM Product p WHERE p.store_fk =[*]= null"; expected "ALL, ANY, SOME"; SQL statement: SELECT * FROM Product p WHERE p.store_fk == null [42001-210] +2023-05-15 22:40:22 database: flush +org.h2.message.DbException: Внутренняя ошибка: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" +General error: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" [50000-199] + at org.h2.message.DbException.get(DbException.java:194) + at org.h2.message.DbException.convert(DbException.java:347) + at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:90) + at org.h2.mvstore.MVStore.handleException(MVStore.java:2787) + at org.h2.mvstore.MVStore.panic(MVStore.java:441) + at org.h2.mvstore.MVStore.(MVStore.java:404) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3343) + at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:162) + at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:95) + at org.h2.engine.Database.getPageStore(Database.java:2739) + at org.h2.engine.Database.open(Database.java:769) + at org.h2.engine.Database.openDatabase(Database.java:319) + at org.h2.engine.Database.(Database.java:313) + at org.h2.engine.Engine.openSession(Engine.java:69) + at org.h2.engine.Engine.openSession(Engine.java:201) + at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) + at org.h2.engine.Engine.createSession(Engine.java:161) + at org.h2.engine.Engine.createSession(Engine.java:31) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:169) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:148) + at org.h2.Driver.connect(Driver.java:69) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$1(JDBCDataSource.java:241) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:254) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:273) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:143) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.openConnection(H2DataSource.java:74) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:103) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:102) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:61) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:128) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:109) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.(H2DataSource.java:43) + at org.jkiss.dbeaver.ext.h2.model.H2MetaModel.createDataSourceImpl(H2MetaModel.java:55) + at org.jkiss.dbeaver.ext.generic.GenericDataSourceProvider.openDataSource(GenericDataSourceProvider.java:106) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1205) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:1070) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:97) + at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:115) + at org.jkiss.dbeaver.ui.actions.datasource.UIServiceConnectionsImpl.initConnection(UIServiceConnectionsImpl.java:87) + at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:158) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:225) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1) + at org.jkiss.dbeaver.model.navigator.DBNUtils.getNodeChildrenFiltered(DBNUtils.java:80) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72) + at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" +General error: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" [50000-199] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) + ... 51 more +Caused by: java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5] + at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:883) + at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:705) + at org.h2.mvstore.MVStore.(MVStore.java:401) + ... 45 more +2023-05-15 22:40:22 database: opening D:/IP Labs/Лабораторная 1/backend/ipLab/data +org.h2.message.DbException: Файл поврежден при чтении строки: null. Возможные решения: используйте утилиту восстановления (recovery tool) +File corrupted while reading record: null. Possible solution: use the recovery tool [90030-199] + at org.h2.message.DbException.get(DbException.java:194) + at org.h2.mvstore.db.MVTableEngine$Store.convertIllegalStateException(MVTableEngine.java:205) + at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:173) + at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:95) + at org.h2.engine.Database.getPageStore(Database.java:2739) + at org.h2.engine.Database.open(Database.java:769) + at org.h2.engine.Database.openDatabase(Database.java:319) + at org.h2.engine.Database.(Database.java:313) + at org.h2.engine.Engine.openSession(Engine.java:69) + at org.h2.engine.Engine.openSession(Engine.java:201) + at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) + at org.h2.engine.Engine.createSession(Engine.java:161) + at org.h2.engine.Engine.createSession(Engine.java:31) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:169) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:148) + at org.h2.Driver.connect(Driver.java:69) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$1(JDBCDataSource.java:241) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:254) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:273) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:143) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.openConnection(H2DataSource.java:74) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:103) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:102) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:61) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:128) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:109) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.(H2DataSource.java:43) + at org.jkiss.dbeaver.ext.h2.model.H2MetaModel.createDataSourceImpl(H2MetaModel.java:55) + at org.jkiss.dbeaver.ext.generic.GenericDataSourceProvider.openDataSource(GenericDataSourceProvider.java:106) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1205) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:1070) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:97) + at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:115) + at org.jkiss.dbeaver.ui.actions.datasource.UIServiceConnectionsImpl.initConnection(UIServiceConnectionsImpl.java:87) + at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:158) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:225) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1) + at org.jkiss.dbeaver.model.navigator.DBNUtils.getNodeChildrenFiltered(DBNUtils.java:80) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72) + at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Файл поврежден при чтении строки: null. Возможные решения: используйте утилиту восстановления (recovery tool) +File corrupted while reading record: null. Possible solution: use the recovery tool [90030-199] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:617) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) + ... 46 more +Caused by: java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5] + at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:883) + at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:705) + at org.h2.mvstore.MVStore.(MVStore.java:401) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3343) + at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:162) + ... 43 more +2023-05-15 22:40:33 database: flush +org.h2.message.DbException: Внутренняя ошибка: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" +General error: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" [50000-199] + at org.h2.message.DbException.get(DbException.java:194) + at org.h2.message.DbException.convert(DbException.java:347) + at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:90) + at org.h2.mvstore.MVStore.handleException(MVStore.java:2787) + at org.h2.mvstore.MVStore.panic(MVStore.java:441) + at org.h2.mvstore.MVStore.(MVStore.java:404) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3343) + at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:162) + at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:95) + at org.h2.engine.Database.getPageStore(Database.java:2739) + at org.h2.engine.Database.open(Database.java:769) + at org.h2.engine.Database.openDatabase(Database.java:319) + at org.h2.engine.Database.(Database.java:313) + at org.h2.engine.Engine.openSession(Engine.java:69) + at org.h2.engine.Engine.openSession(Engine.java:201) + at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) + at org.h2.engine.Engine.createSession(Engine.java:161) + at org.h2.engine.Engine.createSession(Engine.java:31) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:169) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:148) + at org.h2.Driver.connect(Driver.java:69) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$1(JDBCDataSource.java:241) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:254) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:273) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:143) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.openConnection(H2DataSource.java:74) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:103) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:102) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:61) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:128) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:109) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.(H2DataSource.java:43) + at org.jkiss.dbeaver.ext.h2.model.H2MetaModel.createDataSourceImpl(H2MetaModel.java:55) + at org.jkiss.dbeaver.ext.generic.GenericDataSourceProvider.openDataSource(GenericDataSourceProvider.java:106) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1205) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:1070) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:97) + at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:115) + at org.jkiss.dbeaver.ui.actions.datasource.UIServiceConnectionsImpl.initConnection(UIServiceConnectionsImpl.java:87) + at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:158) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:225) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1) + at org.jkiss.dbeaver.model.navigator.DBNUtils.getNodeChildrenFiltered(DBNUtils.java:80) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72) + at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" +General error: "java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5]" [50000-199] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) + ... 51 more +Caused by: java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5] + at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:883) + at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:705) + at org.h2.mvstore.MVStore.(MVStore.java:401) + ... 45 more +2023-05-15 22:40:33 database: opening D:/IP Labs/Лабораторная 1/backend/ipLab/data +org.h2.message.DbException: Файл поврежден при чтении строки: null. Возможные решения: используйте утилиту восстановления (recovery tool) +File corrupted while reading record: null. Possible solution: use the recovery tool [90030-199] + at org.h2.message.DbException.get(DbException.java:194) + at org.h2.mvstore.db.MVTableEngine$Store.convertIllegalStateException(MVTableEngine.java:205) + at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:173) + at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:95) + at org.h2.engine.Database.getPageStore(Database.java:2739) + at org.h2.engine.Database.open(Database.java:769) + at org.h2.engine.Database.openDatabase(Database.java:319) + at org.h2.engine.Database.(Database.java:313) + at org.h2.engine.Engine.openSession(Engine.java:69) + at org.h2.engine.Engine.openSession(Engine.java:201) + at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) + at org.h2.engine.Engine.createSession(Engine.java:161) + at org.h2.engine.Engine.createSession(Engine.java:31) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:169) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:148) + at org.h2.Driver.connect(Driver.java:69) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$1(JDBCDataSource.java:241) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:254) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:273) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:143) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.openConnection(H2DataSource.java:74) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:103) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:102) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:61) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:128) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:109) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.(H2DataSource.java:43) + at org.jkiss.dbeaver.ext.h2.model.H2MetaModel.createDataSourceImpl(H2MetaModel.java:55) + at org.jkiss.dbeaver.ext.generic.GenericDataSourceProvider.openDataSource(GenericDataSourceProvider.java:106) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1205) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:1070) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:97) + at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:115) + at org.jkiss.dbeaver.ui.actions.datasource.UIServiceConnectionsImpl.initConnection(UIServiceConnectionsImpl.java:87) + at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:158) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:225) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1) + at org.jkiss.dbeaver.model.navigator.DBNUtils.getNodeChildrenFiltered(DBNUtils.java:80) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72) + at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Файл поврежден при чтении строки: null. Возможные решения: используйте утилиту восстановления (recovery tool) +File corrupted while reading record: null. Possible solution: use the recovery tool [90030-199] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:617) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) + ... 46 more +Caused by: java.lang.IllegalStateException: The write format 2 is larger than the supported format 1, and the file was not opened in read-only mode [1.4.199/5] + at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:883) + at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:705) + at org.h2.mvstore.MVStore.(MVStore.java:401) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3343) + at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:162) + ... 43 more +2023-05-15 22:42:22 database: wrong user or password; user: "SE" +org.h2.message.DbException: Неверное имя пользователя или пароль +Wrong user name or password [28000-210] + 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.engine.Engine.openSession(Engine.java:154) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:122) + at org.h2.Driver.connect(Driver.java:59) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$1(JDBCDataSource.java:241) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:254) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:273) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:143) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.openConnection(H2DataSource.java:74) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:103) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:102) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:61) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:128) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:109) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.(H2DataSource.java:43) + at org.jkiss.dbeaver.ext.h2.model.H2MetaModel.createDataSourceImpl(H2MetaModel.java:55) + at org.jkiss.dbeaver.ext.generic.GenericDataSourceProvider.openDataSource(GenericDataSourceProvider.java:106) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1205) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:1070) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:97) + at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:115) + at org.jkiss.dbeaver.ui.actions.datasource.UIServiceConnectionsImpl.initConnection(UIServiceConnectionsImpl.java:87) + at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:158) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:225) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1) + at org.jkiss.dbeaver.model.navigator.DBNUtils.getNodeChildrenFiltered(DBNUtils.java:80) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72) + at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +Caused by: org.h2.jdbc.JdbcSQLInvalidAuthorizationSpecException: Неверное имя пользователя или пароль +Wrong user name or password [28000-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:529) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + ... 38 more +2023-05-15 22:43:16 jdbc[3]: exception +java.sql.SQLClientInfoException: Client info name 'ApplicationName' not supported. + at org.h2.jdbc.JdbcConnection.setClientInfo(JdbcConnection.java:1573) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.populateClientAppName(GenericDataSource.java:183) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:146) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.openConnection(H2DataSource.java:74) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:103) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:102) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:61) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:128) + at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:109) + at org.jkiss.dbeaver.ext.h2.model.H2DataSource.(H2DataSource.java:43) + at org.jkiss.dbeaver.ext.h2.model.H2MetaModel.createDataSourceImpl(H2MetaModel.java:55) + at org.jkiss.dbeaver.ext.generic.GenericDataSourceProvider.openDataSource(GenericDataSourceProvider.java:106) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1205) + at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:1070) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70) + at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:97) + at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:115) + at org.jkiss.dbeaver.ui.actions.datasource.UIServiceConnectionsImpl.initConnection(UIServiceConnectionsImpl.java:87) + at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:158) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:225) + at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1) + at org.jkiss.dbeaver.model.navigator.DBNUtils.getNodeChildrenFiltered(DBNUtils.java:80) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49) + at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72) + at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +2023-05-15 22:43:44 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Столбец "KEY_SEQ" не найден +Column "KEY_SEQ" not found [42122-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:521) + 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.jdbc.JdbcResultSet.getColumnIndex(JdbcResultSet.java:3492) + at org.h2.jdbc.JdbcResultSet.getInt(JdbcResultSet.java:337) + at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCResultSetImpl.getInt(JDBCResultSetImpl.java:500) + at org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils.safeGetInt(JDBCUtils.java:110) + at org.jkiss.dbeaver.ext.generic.model.GenericUtils.safeGetInt(GenericUtils.java:84) + at org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel.createConstraintColumnsImpl(GenericMetaModel.java:819) + at org.jkiss.dbeaver.ext.h2.model.H2MetaModel.createConstraintColumnsImpl(H2MetaModel.java:178) + at org.jkiss.dbeaver.ext.generic.model.ConstraintKeysCache.fetchObjectRow(ConstraintKeysCache.java:98) + at org.jkiss.dbeaver.ext.generic.model.ConstraintKeysCache.fetchObjectRow(ConstraintKeysCache.java:1) + at org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCCompositeCache.loadObjects(JDBCCompositeCache.java:360) + at org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCCompositeCache.getObjects(JDBCCompositeCache.java:120) + at org.jkiss.dbeaver.ext.generic.model.GenericTableBase.getConstraints(GenericTableBase.java:222) + at org.jkiss.dbeaver.ext.generic.model.GenericTableBase.getConstraints(GenericTableBase.java:1) + at org.jkiss.dbeaver.model.virtual.DBVUtils.getAllConstraints(DBVUtils.java:310) + at org.jkiss.dbeaver.erd.model.ERDContentProviderDefault.fillEntityFromObject(ERDContentProviderDefault.java:76) + at org.jkiss.dbeaver.erd.ui.model.ERDContentProviderDecorated.fillEntityFromObject(ERDContentProviderDecorated.java:58) + at org.jkiss.dbeaver.erd.model.ERDUtils.makeEntityFromObject(ERDUtils.java:132) + at org.jkiss.dbeaver.erd.model.ERDDiagram.fillEntities(ERDDiagram.java:288) + at org.jkiss.dbeaver.erd.ui.editor.ERDEditorEmbedded.loadFromDatabase(ERDEditorEmbedded.java:225) + at org.jkiss.dbeaver.erd.ui.editor.ERDEditorEmbedded$1.evaluate(ERDEditorEmbedded.java:172) + at org.jkiss.dbeaver.erd.ui.editor.ERDEditorEmbedded$1.evaluate(ERDEditorEmbedded.java:1) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88) + at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72) + at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +2023-05-15 22:45:44 database: flush +org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" +General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" [50000-210] + at org.h2.message.DbException.get(DbException.java:216) + at org.h2.message.DbException.convert(DbException.java:414) + at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120) + at org.h2.mvstore.MVStore.handleException(MVStore.java:3296) + at org.h2.mvstore.MVStore.panic(MVStore.java:585) + at org.h2.mvstore.MVStore.(MVStore.java:461) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056) + at org.h2.mvstore.db.Store.(Store.java:129) + at org.h2.engine.Database.(Database.java:324) + at org.h2.engine.Engine.openSession(Engine.java:92) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:122) + at org.h2.Driver.connect(Driver.java:59) + at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) + at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) + at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) + at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) + at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) + at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:100) + at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.getConnectionUrl(H2ConsoleAutoConfiguration.java:94) + at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) + at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) + at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) + at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) + at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) + at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) + at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) + at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) + at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) + at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) + at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.logDataSources(H2ConsoleAutoConfiguration.java:86) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:69) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.withThreadContextClassLoader(H2ConsoleAutoConfiguration.java:78) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:69) + 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.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1324) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1161) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:208) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:199) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:94) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.(ServletContextInitializerBeans.java:85) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:261) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:235) + at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:52) + at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5144) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383) + at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) + at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) + at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) + at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) + at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383) + at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) + at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) + at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) + at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) + at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:252) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) + at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) + at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:926) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) + at org.apache.catalina.startup.Tomcat.start(Tomcat.java:485) + at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) + at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) + at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:486) + at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:210) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) + at com.example.ipLab.IpLabApplication.main(IpLabApplication.java:12) + 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.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" +General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" [50000-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:573) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + ... 103 more +Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7] + at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004) + at org.h2.mvstore.FileStore.open(FileStore.java:163) + at org.h2.mvstore.MVStore.(MVStore.java:444) + ... 97 more +2023-05-15 22:45:46 database: flush +org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" +General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" [50000-210] + at org.h2.message.DbException.get(DbException.java:216) + at org.h2.message.DbException.convert(DbException.java:414) + at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120) + at org.h2.mvstore.MVStore.handleException(MVStore.java:3296) + at org.h2.mvstore.MVStore.panic(MVStore.java:585) + at org.h2.mvstore.MVStore.(MVStore.java:461) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056) + at org.h2.mvstore.db.Store.(Store.java:129) + at org.h2.engine.Database.(Database.java:324) + at org.h2.engine.Engine.openSession(Engine.java:92) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:122) + at org.h2.Driver.connect(Driver.java:59) + at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) + at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) + at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) + at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) + at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) + at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:100) + at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) + at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:177) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36) + at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119) + at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255) + at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230) + at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207) + at org.hibernate.boot.model.relational.Database.(Database.java:44) + at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218) + at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:191) + at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138) + at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350) + at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421) + at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) + at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130) + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) + at com.example.ipLab.IpLabApplication.main(IpLabApplication.java:12) + 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.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" +General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" [50000-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:573) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + ... 64 more +Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7] + at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004) + at org.h2.mvstore.FileStore.open(FileStore.java:163) + at org.h2.mvstore.MVStore.(MVStore.java:444) + ... 58 more +2023-05-15 22:45:48 database: flush +org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" +General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" [50000-210] + at org.h2.message.DbException.get(DbException.java:216) + at org.h2.message.DbException.convert(DbException.java:414) + at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120) + at org.h2.mvstore.MVStore.handleException(MVStore.java:3296) + at org.h2.mvstore.MVStore.panic(MVStore.java:585) + at org.h2.mvstore.MVStore.(MVStore.java:461) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056) + at org.h2.mvstore.db.Store.(Store.java:129) + at org.h2.engine.Database.(Database.java:324) + at org.h2.engine.Engine.openSession(Engine.java:92) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:122) + at org.h2.Driver.connect(Driver.java:59) + at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) + at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) + at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) + at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) + at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) + at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:100) + at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) + at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284) + at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:41) + at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcConnection(ImprovedExtractionContextImpl.java:63) + at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcDatabaseMetaData(ImprovedExtractionContextImpl.java:70) + at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.processTableResultSet(InformationExtractorJdbcDatabaseMetaDataImpl.java:64) + at org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.getTables(AbstractInformationExtractorImpl.java:564) + at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.getTablesInformation(DatabaseInformationImpl.java:122) + at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71) + at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:225) + at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126) + at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284) + at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143) + at java.base/java.util.HashMap.forEach(HashMap.java:1421) + at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140) + at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:336) + at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415) + at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425) + at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) + at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130) + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) + at com.example.ipLab.IpLabApplication.main(IpLabApplication.java:12) + 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.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" +General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7]" [50000-210] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:573) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) + ... 68 more +Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/IP Labs/Лабораторная 1/backend/ipLab/data.mv.db [2.1.210/7] + at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004) + at org.h2.mvstore.FileStore.open(FileStore.java:163) + at org.h2.mvstore.MVStore.(MVStore.java:444) + ... 62 more diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java index c1bf254..e2c1bfa 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java @@ -1,12 +1,15 @@ package com.example.ipLab.StoreDataBase.Controllers; import com.example.ipLab.StoreDataBase.DTO.OrderedDTO; +import com.example.ipLab.StoreDataBase.Model.CustomUser; import com.example.ipLab.StoreDataBase.Model.Ordered; +import com.example.ipLab.StoreDataBase.Model.UserRole; import com.example.ipLab.StoreDataBase.Service.CustomerService; import com.example.ipLab.StoreDataBase.Service.OrderService; import com.example.ipLab.StoreDataBase.Service.ProductService; import com.example.ipLab.WebConfiguration; import jakarta.validation.Valid; +import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -30,10 +33,18 @@ public class OrderedController { } @GetMapping - public List getOrdereds(){ - return orderedService.getAllOrders().stream() - .map(OrderedDTO::new) - .toList(); + public List getOrdereds(@AuthenticationPrincipal CustomUser user){ + if (user.getRole() == UserRole.USER){ + return orderedService.getOrdersByCustomerId(user.getUserID()).stream() + .map(OrderedDTO::new) + .toList(); + } + else{ + return orderedService.getAllOrders().stream() + .map(OrderedDTO::new) + .toList(); + } + } @PostMapping diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java index ba86444..acc71e5 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java @@ -1,10 +1,13 @@ package com.example.ipLab.StoreDataBase.Controllers; import com.example.ipLab.StoreDataBase.DTO.ProductDTO; +import com.example.ipLab.StoreDataBase.Model.CustomUser; import com.example.ipLab.StoreDataBase.Model.Product; +import com.example.ipLab.StoreDataBase.Model.UserRole; import com.example.ipLab.StoreDataBase.Service.ProductService; import com.example.ipLab.WebConfiguration; import jakarta.validation.Valid; +import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -24,10 +27,18 @@ public class ProductController { } @GetMapping - public List getProducts(){ - return productService.getAllProducts().stream() - .map(ProductDTO::new) - .toList(); + public List getProducts(@AuthenticationPrincipal CustomUser user){ + if (user.getRole() == UserRole.USER){ + return productService.getAllProductsWithStores().stream() + .map(ProductDTO::new) + .toList(); + } + else{ + return productService.getAllProducts().stream() + .map(ProductDTO::new) + .toList(); + } + } @GetMapping("/getWithStores") diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Model/User.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Model/User.java index aeead35..c355db9 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Model/User.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Model/User.java @@ -18,7 +18,6 @@ public class User { @NotBlank private String password; @Column - @NotBlank private Long userId; private UserRole role; @@ -61,6 +60,10 @@ public class User { return role; } + public Long getUserId() { + return userId; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Service/UserService.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Service/UserService.java index 951735e..0e710f4 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Service/UserService.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Service/UserService.java @@ -92,6 +92,6 @@ public class UserService implements UserDetailsService { throw new UsernameNotFoundException(username); } return new CustomUser( - userEntity.getLogin(), userEntity.getPassword(), Collections.singleton(userEntity.getRole()), userEntity.getId(), userEntity.getRole()); + userEntity.getLogin(), userEntity.getPassword(), Collections.singleton(userEntity.getRole()), userEntity.getUserId(), userEntity.getRole()); } } diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 869a6bc..fc8eb73 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,10 +1,13 @@ import { useRoutes, Outlet, BrowserRouter } from 'react-router-dom'; +import { useState, useEffect } from 'react'; import Header from './components/common/Header'; import CustomerPage from './components/pages/customerPage'; import StorePage from './components/pages/storePage'; import ProductPage from './components/pages/productPage'; import OrderPage from './components/pages/orderPage'; -import AddToStorePage from './components/pages/addToStorePage' +import AddToStorePage from './components/pages/addToStorePage'; +import LoginPage from './components/pages/loginPage'; +import Logout from './components/pages/logout'; import './styleSite.css'; function Router(props) { @@ -13,14 +16,32 @@ function Router(props) { export default function App() { const routes = [ - { index: true, element: }, - { path: 'customer', element: , label:'Покупатели'}, + { index: true, element: }, + localStorage.getItem("role") === "ADMIN" && { path: 'customer', element: , label:'Покупатели'}, { path: 'store', element: , label: 'Магазины' }, { path: 'product', element: , label: 'Товары' }, { path: 'order', element: , label: 'Заказы'}, - { path: 'addToStore', element: , label: 'Доставка'} + localStorage.getItem("role") === "ADMIN" && { path: 'addToStore', element: , label: 'Доставка'}, + { path: '/login', element: }, + { path: '/logout', element: } ]; const links = routes.filter(route => route.hasOwnProperty('label')); + + const [token, setToken] = useState(localStorage.getItem('token')); + + useEffect(() => { + + function handleStorageChange() { + setToken(localStorage.getItem('token')); + } + + window.addEventListener('storage', handleStorageChange); + + return () => { + window.removeEventListener('storage', handleStorageChange); + }; + }, []); + const rootRoute = [ { path: '/', element: render(links), children: routes } ]; @@ -29,7 +50,7 @@ export default function App() { console.info('render links'); return ( <> -
+
diff --git a/frontend/src/checkLogin.jsx b/frontend/src/checkLogin.jsx new file mode 100644 index 0000000..4c926b3 --- /dev/null +++ b/frontend/src/checkLogin.jsx @@ -0,0 +1,24 @@ +import React from 'react' +import { useNavigate} from "react-router-dom"; +import { useEffect } from 'react'; + +const checkLogin = (Component) => { + const AuthenticatedComponent = (props) => { + const navigate = useNavigate(); + const token = localStorage.getItem('token'); + + useEffect(() => { + if (!token || token === 'undefined') { + navigate('/login'); + } + }, [navigate, token]); + + if (token && token !== 'undefined') { + return + } + return null; + } + return AuthenticatedComponent; +} + +export default checkLogin; \ No newline at end of file diff --git a/frontend/src/components/common/Header.jsx b/frontend/src/components/common/Header.jsx index e42ac22..46f13a9 100644 --- a/frontend/src/components/common/Header.jsx +++ b/frontend/src/components/common/Header.jsx @@ -10,7 +10,7 @@ export default function Header(props){ *