Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
5309fd92e8 | |||
2f859b0495 |
@ -4,9 +4,31 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="67d3f0b7-2fd3-4b40-a135-0347e30e6207" name="Changes" comment="add log file">
|
<list default="true" id="67d3f0b7-2fd3-4b40-a135-0347e30e6207" name="Changes" comment="lw5">
|
||||||
|
<change afterPath="$PROJECT_DIR$/dcaa/src/main/java/com/spring/dcaa/config/OpenApiConfig.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/dcaa/src/main/resources/db/changelog/changeset/create-users-table.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/controller/AuthController.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/dto/AuthRequest.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/error/GlobalExceptionHandler.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/error/UnauthorizedException.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/filter/JwtFilter.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/model/Role.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/model/User.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/repository/UserRepository.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/service/AuthUtil.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/service/JwtUtil.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/gateway/src/main/java/com/spring/gateway/service/UserService.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/dcaa/src/main/resources/db/changelog/db.changelog-master.xml" beforeDir="false" afterPath="$PROJECT_DIR$/dcaa/src/main/resources/db/changelog/db.changelog-master.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/docker-compose.yml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/gateway/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/gateway/pom.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/gateway/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/gateway/src/main/resources/application.yml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/minio/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/minio/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/minio/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/minio/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/minio/src/main/java/com/spring/minio/consumer/Consumer.java" beforeDir="false" afterPath="$PROJECT_DIR$/minio/src/main/java/com/spring/minio/consumer/Consumer.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/minio/src/main/java/com/spring/minio/controller/MinioController.java" beforeDir="false" afterPath="$PROJECT_DIR$/minio/src/main/java/com/spring/minio/controller/MinioController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/report/logs/application.log" beforeDir="false" afterPath="$PROJECT_DIR$/report/logs/application.log" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/report/src/main/java/com/spring/report/controller/VisitorController.java" beforeDir="false" afterPath="$PROJECT_DIR$/report/src/main/java/com/spring/report/controller/VisitorController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/report/src/main/java/com/spring/report/kafka/Producer.java" beforeDir="false" afterPath="$PROJECT_DIR$/report/src/main/java/com/spring/report/kafka/Producer.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -34,16 +56,18 @@
|
|||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
|
"Docker.docker-compose.yml.postgres: Compose Deployment.executor": "Run",
|
||||||
"Docker.docker-compose.yml: Compose Deployment.executor": "Run",
|
"Docker.docker-compose.yml: Compose Deployment.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "lw5",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "D:/java/dcaa-mcs/report/src/main/resources",
|
"last_opened_file_path": "D:/java/dcaa-mcs",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"settings.editor.selected.configurable": "bigdataide_conn_settings",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}]]></component>
|
||||||
@ -54,7 +78,7 @@
|
|||||||
<recent name="D:\java\dcaa-mcs\dcaa\src\main\resources" />
|
<recent name="D:\java\dcaa-mcs\dcaa\src\main\resources" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager" selected="Docker.docker-compose.yml.postgres: Compose Deployment">
|
||||||
<configuration default="true" type="docker-deploy" factoryName="docker-compose.yml" temporary="true">
|
<configuration default="true" type="docker-deploy" factoryName="docker-compose.yml" temporary="true">
|
||||||
<deployment type="docker-compose.yml">
|
<deployment type="docker-compose.yml">
|
||||||
<settings />
|
<settings />
|
||||||
@ -69,8 +93,22 @@
|
|||||||
</deployment>
|
</deployment>
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="docker-compose.yml.postgres: Compose Deployment" type="docker-deploy" factoryName="docker-compose.yml" temporary="true" server-name="Docker">
|
||||||
|
<deployment type="docker-compose.yml">
|
||||||
|
<settings>
|
||||||
|
<option name="services">
|
||||||
|
<list>
|
||||||
|
<option value="postgres" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="sourceFilePath" value="docker-compose.yml" />
|
||||||
|
</settings>
|
||||||
|
</deployment>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="Docker.docker-compose.yml.postgres: Compose Deployment" />
|
||||||
<item itemvalue="Docker.docker-compose.yml: Compose Deployment" />
|
<item itemvalue="Docker.docker-compose.yml: Compose Deployment" />
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
@ -95,6 +133,8 @@
|
|||||||
<workItem from="1729199229123" duration="2034000" />
|
<workItem from="1729199229123" duration="2034000" />
|
||||||
<workItem from="1729271426421" duration="377000" />
|
<workItem from="1729271426421" duration="377000" />
|
||||||
<workItem from="1729706571244" duration="12931000" />
|
<workItem from="1729706571244" duration="12931000" />
|
||||||
|
<workItem from="1729789297391" duration="7392000" />
|
||||||
|
<workItem from="1731614556569" duration="3561000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="add minio">
|
<task id="LOCAL-00001" summary="add minio">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@ -112,7 +152,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1729725028044</updated>
|
<updated>1729725028044</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="3" />
|
<task id="LOCAL-00003" summary="lw5">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1729797106713</created>
|
||||||
|
<option name="number" value="00003" />
|
||||||
|
<option name="presentableId" value="LOCAL-00003" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1729797106713</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="4" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@ -133,6 +181,7 @@
|
|||||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||||
<MESSAGE value="add minio" />
|
<MESSAGE value="add minio" />
|
||||||
<MESSAGE value="add log file" />
|
<MESSAGE value="add log file" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="add log file" />
|
<MESSAGE value="lw5" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="lw5" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
297
dcaa/logs/application.log
Normal file
297
dcaa/logs/application.log
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
2024-11-14 23:56:59 [main] INFO c.s.d.DistributedComputingAndApplicationsApplication - Starting DistributedComputingAndApplicationsApplication using Java 17.0.8 with PID 4632 (D:\java\dcaa-mcs\dcaa\target\classes started by amaya in D:\java\dcaa-mcs\dcaa)
|
||||||
|
2024-11-14 23:56:59 [main] INFO c.s.d.DistributedComputingAndApplicationsApplication - No active profile set, falling back to 1 default profile: "default"
|
||||||
|
2024-11-14 23:57:00 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
|
||||||
|
2024-11-14 23:57:00 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 66 ms. Found 1 JPA repository interface.
|
||||||
|
2024-11-14 23:57:01 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port 8080 (http)
|
||||||
|
2024-11-14 23:57:01 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
|
||||||
|
2024-11-14 23:57:01 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
|
||||||
|
2024-11-14 23:57:01 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/10.1.28]
|
||||||
|
2024-11-14 23:57:01 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
|
||||||
|
2024-11-14 23:57:01 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1876 ms
|
||||||
|
2024-11-14 23:57:01 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||||
|
2024-11-14 23:57:02 [main] INFO com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@58a7dc4
|
||||||
|
2024-11-14 23:57:02 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||||
|
2024-11-14 23:57:02 [main] INFO liquibase.database - Set default schema name to public
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.changelog - Reading from public.databasechangelog
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.lockservice - Successfully acquired change log lock
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.command - Using deploymentId: 1614223376
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.changelog - Reading from public.databasechangelog
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.ui - Running Changeset: db/changelog/changeset/create-users-table.xml::create-users-table::darya
|
||||||
|
2024-11-14 23:57:03 [main] ERROR liquibase.changelog - ChangeSet db/changelog/changeset/create-users-table.xml::create-users-table::darya encountered an exception.
|
||||||
|
liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:473)
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:80)
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:182)
|
||||||
|
at liquibase.executor.AbstractExecutor.execute(AbstractExecutor.java:141)
|
||||||
|
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1176)
|
||||||
|
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:764)
|
||||||
|
at liquibase.changelog.visitor.UpdateVisitor.executeAcceptedChange(UpdateVisitor.java:119)
|
||||||
|
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:68)
|
||||||
|
at liquibase.changelog.ChangeLogIterator$2.lambda$run$0(ChangeLogIterator.java:133)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:122)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.Scope.child(Scope.java:256)
|
||||||
|
at liquibase.Scope.child(Scope.java:260)
|
||||||
|
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:89)
|
||||||
|
at liquibase.command.core.AbstractUpdateCommandStep.lambda$run$0(AbstractUpdateCommandStep.java:112)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.command.core.AbstractUpdateCommandStep.run(AbstractUpdateCommandStep.java:110)
|
||||||
|
at liquibase.command.core.UpdateCommandStep.run(UpdateCommandStep.java:105)
|
||||||
|
at liquibase.command.CommandScope.execute(CommandScope.java:219)
|
||||||
|
at liquibase.Liquibase.lambda$update$0(Liquibase.java:245)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.Liquibase.runInScope(Liquibase.java:1436)
|
||||||
|
at liquibase.Liquibase.update(Liquibase.java:234)
|
||||||
|
at liquibase.Liquibase.update(Liquibase.java:212)
|
||||||
|
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:297)
|
||||||
|
at liquibase.integration.spring.SpringLiquibase.lambda$afterPropertiesSet$0(SpringLiquibase.java:249)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.Scope.child(Scope.java:256)
|
||||||
|
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:242)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337)
|
||||||
|
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:954)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||||
|
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
|
||||||
|
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
|
||||||
|
at com.spring.dcaa.DistributedComputingAndApplicationsApplication.main(DistributedComputingAndApplicationsApplication.java:10)
|
||||||
|
Caused by: org.postgresql.util.PSQLException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44
|
||||||
|
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
|
||||||
|
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412)
|
||||||
|
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502)
|
||||||
|
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:341)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:326)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:302)
|
||||||
|
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:297)
|
||||||
|
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||||
|
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:467)
|
||||||
|
... 63 common frames omitted
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.util - UPDATE SUMMARY
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.util - Run: 0
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.util - Previously run: 1
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.util - Filtered out: 0
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.util - -------------------------------
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.util - Total change sets: 1
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.util - Update summary generated
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.command - Update command encountered an exception.
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.lockservice - Successfully released change log lock
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.command - Logging exception.
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.ui - ERROR: Exception Details
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.ui - ERROR: Exception Primary Class: PSQLException
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.ui - ERROR: Exception Primary Reason: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.ui - ERROR: Exception Primary Source: PostgreSQL 16.0
|
||||||
|
2024-11-14 23:57:03 [main] INFO liquibase.command - Command execution complete
|
||||||
|
2024-11-14 23:57:03 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Failed to initialize dependency 'liquibase' of LoadTimeWeaverAware bean 'entityManagerFactory': Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changeset/create-users-table.xml::create-users-table::darya:
|
||||||
|
Reason: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
2024-11-14 23:57:03 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
|
||||||
|
2024-11-14 23:57:03 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
|
||||||
|
2024-11-14 23:57:03 [main] INFO o.a.catalina.core.StandardService - Stopping service [Tomcat]
|
||||||
|
2024-11-14 23:57:03 [main] INFO o.s.b.a.l.ConditionEvaluationReportLogger -
|
||||||
|
|
||||||
|
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
|
||||||
|
2024-11-14 23:57:03 [main] ERROR o.s.boot.SpringApplication - Application run failed
|
||||||
|
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Failed to initialize dependency 'liquibase' of LoadTimeWeaverAware bean 'entityManagerFactory': Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changeset/create-users-table.xml::create-users-table::darya:
|
||||||
|
Reason: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:326)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:954)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||||
|
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
|
||||||
|
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
|
||||||
|
at com.spring.dcaa.DistributedComputingAndApplicationsApplication.main(DistributedComputingAndApplicationsApplication.java:10)
|
||||||
|
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changeset/create-users-table.xml::create-users-table::darya:
|
||||||
|
Reason: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1806)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337)
|
||||||
|
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313)
|
||||||
|
... 10 common frames omitted
|
||||||
|
Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changeset/create-users-table.xml::create-users-table::darya:
|
||||||
|
Reason: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:259)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802)
|
||||||
|
... 17 common frames omitted
|
||||||
|
Caused by: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changeset/create-users-table.xml::create-users-table::darya:
|
||||||
|
Reason: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at liquibase.command.CommandScope.execute(CommandScope.java:257)
|
||||||
|
at liquibase.Liquibase.lambda$update$0(Liquibase.java:245)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.Liquibase.runInScope(Liquibase.java:1436)
|
||||||
|
at liquibase.Liquibase.update(Liquibase.java:234)
|
||||||
|
at liquibase.Liquibase.update(Liquibase.java:212)
|
||||||
|
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:297)
|
||||||
|
at liquibase.integration.spring.SpringLiquibase.lambda$afterPropertiesSet$0(SpringLiquibase.java:249)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.Scope.child(Scope.java:256)
|
||||||
|
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:242)
|
||||||
|
... 19 common frames omitted
|
||||||
|
Caused by: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changeset/create-users-table.xml::create-users-table::darya:
|
||||||
|
Reason: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:151)
|
||||||
|
at liquibase.command.core.AbstractUpdateCommandStep.lambda$run$0(AbstractUpdateCommandStep.java:112)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.command.core.AbstractUpdateCommandStep.run(AbstractUpdateCommandStep.java:110)
|
||||||
|
at liquibase.command.core.UpdateCommandStep.run(UpdateCommandStep.java:105)
|
||||||
|
at liquibase.command.CommandScope.execute(CommandScope.java:219)
|
||||||
|
... 35 common frames omitted
|
||||||
|
Caused by: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changeset/create-users-table.xml::create-users-table::darya:
|
||||||
|
Reason: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:808)
|
||||||
|
at liquibase.changelog.visitor.UpdateVisitor.executeAcceptedChange(UpdateVisitor.java:119)
|
||||||
|
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:68)
|
||||||
|
at liquibase.changelog.ChangeLogIterator$2.lambda$run$0(ChangeLogIterator.java:133)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:122)
|
||||||
|
at liquibase.Scope.lambda$child$0(Scope.java:190)
|
||||||
|
at liquibase.Scope.child(Scope.java:199)
|
||||||
|
at liquibase.Scope.child(Scope.java:189)
|
||||||
|
at liquibase.Scope.child(Scope.java:168)
|
||||||
|
at liquibase.Scope.child(Scope.java:256)
|
||||||
|
at liquibase.Scope.child(Scope.java:260)
|
||||||
|
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:89)
|
||||||
|
... 43 common frames omitted
|
||||||
|
Caused by: liquibase.exception.DatabaseException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44 [Failed SQL: (0) CREATE TABLE public.users (id UUID DEFAULT uuid_generate_v4() NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255), CONSTRAINT users_pkey PRIMARY KEY (id))]
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:473)
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:80)
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:182)
|
||||||
|
at liquibase.executor.AbstractExecutor.execute(AbstractExecutor.java:141)
|
||||||
|
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1176)
|
||||||
|
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:764)
|
||||||
|
... 58 common frames omitted
|
||||||
|
Caused by: org.postgresql.util.PSQLException: ОШИБКА: функция uuid_generate_v4() не существует
|
||||||
|
Подсказка: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов.
|
||||||
|
Позиция: 44
|
||||||
|
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
|
||||||
|
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412)
|
||||||
|
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502)
|
||||||
|
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:341)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:326)
|
||||||
|
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:302)
|
||||||
|
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:297)
|
||||||
|
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||||
|
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||||
|
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:467)
|
||||||
|
... 63 common frames omitted
|
||||||
|
2024-11-14 23:58:12 [main] INFO c.s.d.DistributedComputingAndApplicationsApplication - Starting DistributedComputingAndApplicationsApplication using Java 17.0.8 with PID 9916 (D:\java\dcaa-mcs\dcaa\target\classes started by amaya in D:\java\dcaa-mcs\dcaa)
|
||||||
|
2024-11-14 23:58:12 [main] INFO c.s.d.DistributedComputingAndApplicationsApplication - No active profile set, falling back to 1 default profile: "default"
|
||||||
|
2024-11-14 23:58:13 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
|
||||||
|
2024-11-14 23:58:13 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 47 ms. Found 1 JPA repository interface.
|
||||||
|
2024-11-14 23:58:14 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port 8080 (http)
|
||||||
|
2024-11-14 23:58:14 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
|
||||||
|
2024-11-14 23:58:14 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
|
||||||
|
2024-11-14 23:58:14 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/10.1.28]
|
||||||
|
2024-11-14 23:58:14 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
|
||||||
|
2024-11-14 23:58:14 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1463 ms
|
||||||
|
2024-11-14 23:58:14 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||||
|
2024-11-14 23:58:14 [main] INFO com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@1de13f34
|
||||||
|
2024-11-14 23:58:14 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||||
|
2024-11-14 23:58:14 [main] INFO liquibase.database - Set default schema name to public
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.changelog - Reading from public.databasechangelog
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.lockservice - Successfully acquired change log lock
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.command - Using deploymentId: 1614295434
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.changelog - Reading from public.databasechangelog
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.ui - Running Changeset: db/changelog/changeset/create-users-table.xml::create-users-table::darya
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.changelog - Table users created
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.changelog - ChangeSet db/changelog/changeset/create-users-table.xml::create-users-table::darya ran successfully in 29ms
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.util - UPDATE SUMMARY
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.util - Run: 1
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.util - Previously run: 1
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.util - Filtered out: 0
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.util - -------------------------------
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.util - Total change sets: 2
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.util - Update summary generated
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.command - Update command completed successfully.
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.ui - Liquibase: Update has been successful. Rows affected: 1
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.lockservice - Successfully released change log lock
|
||||||
|
2024-11-14 23:58:15 [main] INFO liquibase.command - Command execution complete
|
||||||
|
2024-11-14 23:58:15 [main] INFO o.h.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
|
||||||
|
2024-11-14 23:58:15 [main] INFO org.hibernate.Version - HHH000412: Hibernate ORM core version 6.5.2.Final
|
||||||
|
2024-11-14 23:58:15 [main] INFO o.h.c.i.RegionFactoryInitiator - HHH000026: Second-level cache disabled
|
||||||
|
2024-11-14 23:58:16 [main] INFO o.s.o.j.p.SpringPersistenceUnitInfo - No LoadTimeWeaver setup: ignoring JPA class transformer
|
||||||
|
2024-11-14 23:58:16 [main] WARN org.hibernate.orm.deprecation - HHH90000025: PostgreSQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
|
||||||
|
2024-11-14 23:58:17 [main] INFO o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
|
||||||
|
2024-11-14 23:58:17 [main] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-11-14 23:58:17 [main] INFO o.s.d.j.r.query.QueryEnhancerFactory - Hibernate is in classpath; If applicable, HQL parser will be used.
|
||||||
|
2024-11-14 23:58:17 [main] WARN o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
|
||||||
|
2024-11-14 23:58:18 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
|
||||||
|
2024-11-14 23:58:18 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port 8080 (http) with context path '/'
|
||||||
|
2024-11-14 23:58:18 [main] INFO c.s.d.DistributedComputingAndApplicationsApplication - Started DistributedComputingAndApplicationsApplication in 6.217 seconds (process running for 6.906)
|
||||||
|
2024-11-14 23:58:26 [SpringApplicationShutdownHook] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-11-14 23:58:26 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
|
||||||
|
2024-11-14 23:58:26 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
|
28
dcaa/src/main/java/com/spring/dcaa/config/OpenApiConfig.java
Normal file
28
dcaa/src/main/java/com/spring/dcaa/config/OpenApiConfig.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package com.spring.dcaa.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||||
|
import io.swagger.v3.oas.annotations.info.Info;
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||||
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||||
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@OpenAPIDefinition(info = @Info(title = "Rental API", version = "v1"))
|
||||||
|
public class OpenApiConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI customOpenAPI() {
|
||||||
|
return new OpenAPI()
|
||||||
|
.addServersItem(new Server().url("http://localhost:6060/rental"))
|
||||||
|
.addSecurityItem(new SecurityRequirement().addList("Bearer"))
|
||||||
|
.components(new io.swagger.v3.oas.models.Components()
|
||||||
|
.addSecuritySchemes("Bearer", new SecurityScheme()
|
||||||
|
.name("Authorization")
|
||||||
|
.type(SecurityScheme.Type.HTTP)
|
||||||
|
.scheme("bearer")
|
||||||
|
.bearerFormat("JWT")));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
|
||||||
|
<changeSet id="create-users-table" author="darya">
|
||||||
|
<createTable tableName="users">
|
||||||
|
<column name="id" type="uuid">
|
||||||
|
<constraints primaryKey="true" nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="email" type="varchar(255)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="password" type="varchar(255)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="role" type="varchar(255)">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -4,4 +4,5 @@
|
|||||||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
|
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
|
||||||
|
|
||||||
<include file="/db/changelog/changeset/create-visitors-table.xml"/>
|
<include file="/db/changelog/changeset/create-visitors-table.xml"/>
|
||||||
|
<include file="/db/changelog/changeset/create-users-table.xml"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
@ -7,6 +7,10 @@ services:
|
|||||||
image: gateway
|
image: gateway
|
||||||
ports:
|
ports:
|
||||||
- "6060:6060"
|
- "6060:6060"
|
||||||
|
environment:
|
||||||
|
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/Rental
|
||||||
|
SPRING_DATASOURCE_USERNAME: role_for_spring
|
||||||
|
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
aliases:
|
aliases:
|
||||||
@ -86,10 +90,39 @@ services:
|
|||||||
backend:
|
backend:
|
||||||
aliases:
|
aliases:
|
||||||
- "myminio"
|
- "myminio"
|
||||||
|
zookeeper:
|
||||||
|
container_name: zookeeper
|
||||||
|
image: confluentinc/cp-zookeeper:latest
|
||||||
|
depends_on:
|
||||||
|
- myminio
|
||||||
|
environment:
|
||||||
|
ZOOKEEPER_CLIENT_PORT: 2181
|
||||||
|
ZOOKEEPER_TICK_TIME: 2000
|
||||||
|
ports:
|
||||||
|
- '2181:2181'
|
||||||
|
networks:
|
||||||
|
backend:
|
||||||
|
aliases:
|
||||||
|
- "zookeeper"
|
||||||
|
kafka:
|
||||||
|
container_name: kafka
|
||||||
|
image: confluentinc/cp-kafka:latest
|
||||||
|
depends_on:
|
||||||
|
- zookeeper
|
||||||
|
ports:
|
||||||
|
- '9092:9092'
|
||||||
|
environment:
|
||||||
|
KAFKA_BROKER_ID: 1
|
||||||
|
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
||||||
|
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
|
||||||
|
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
|
||||||
|
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
||||||
|
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||||
|
networks:
|
||||||
|
backend:
|
||||||
|
aliases:
|
||||||
|
- "kafka"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
volumes:
|
|
||||||
minio-storage:
|
|
||||||
|
99
gateway/logs/application.log
Normal file
99
gateway/logs/application.log
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
2024-11-15 00:35:46 [background-preinit] INFO o.h.validator.internal.util.Version - HV000001: Hibernate Validator 8.0.1.Final
|
||||||
|
2024-11-15 00:35:46 [main] INFO c.spring.gateway.GatewayApplication - Starting GatewayApplication using Java 21.0.1 with PID 6048 (D:\java\dcaa-mcs\gateway\target\classes started by amaya in D:\java\dcaa-mcs\gateway)
|
||||||
|
2024-11-15 00:35:46 [main] INFO c.spring.gateway.GatewayApplication - No active profile set, falling back to 1 default profile: "default"
|
||||||
|
2024-11-15 00:35:48 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
|
||||||
|
2024-11-15 00:35:49 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 208 ms. Found 1 JPA repository interface.
|
||||||
|
2024-11-15 00:35:49 [main] INFO o.s.cloud.context.scope.GenericScope - BeanFactory id=4cd63aab-9820-3caf-9964-cc499267ba55
|
||||||
|
2024-11-15 00:35:50 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||||
|
2024-11-15 00:35:50 [main] INFO com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@506aa618
|
||||||
|
2024-11-15 00:35:50 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||||
|
2024-11-15 00:35:50 [main] INFO o.h.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
|
||||||
|
2024-11-15 00:35:50 [main] INFO org.hibernate.Version - HHH000412: Hibernate ORM core version 6.5.3.Final
|
||||||
|
2024-11-15 00:35:50 [main] INFO o.h.c.i.RegionFactoryInitiator - HHH000026: Second-level cache disabled
|
||||||
|
2024-11-15 00:35:51 [main] INFO o.s.o.j.p.SpringPersistenceUnitInfo - No LoadTimeWeaver setup: ignoring JPA class transformer
|
||||||
|
2024-11-15 00:35:51 [main] WARN org.hibernate.orm.deprecation - HHH90000021: Encountered deprecated setting [hibernate.temp.use_jdbc_metadata_defaults], use [hibernate.boot.allow_jdbc_metadata_access] instead
|
||||||
|
2024-11-15 00:35:51 [main] WARN org.hibernate.orm.deprecation - HHH90000025: PostgreSQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
|
||||||
|
2024-11-15 00:35:56 [main] INFO o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
|
||||||
|
2024-11-15 00:35:56 [main] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.cloud.commons.util.InetUtils - Cannot determine local hostname
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [After]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Before]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Between]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Cookie]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Header]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Host]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Method]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Path]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Query]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [ReadBody]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [RemoteAddr]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [XForwardedRemoteAddr]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Weight]
|
||||||
|
2024-11-15 00:35:58 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [CloudFoundryRouteService]
|
||||||
|
2024-11-15 00:36:01 [main] INFO o.s.cloud.commons.util.InetUtils - Cannot determine local hostname
|
||||||
|
2024-11-15 00:36:03 [main] WARN o.s.b.w.r.c.AnnotationConfigReactiveWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'
|
||||||
|
2024-11-15 00:36:03 [main] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-11-15 00:36:03 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
|
||||||
|
2024-11-15 00:36:03 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
|
||||||
|
2024-11-15 00:36:03 [main] INFO o.s.b.a.l.ConditionEvaluationReportLogger -
|
||||||
|
|
||||||
|
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
|
||||||
|
2024-11-15 00:36:03 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter -
|
||||||
|
|
||||||
|
***************************
|
||||||
|
APPLICATION FAILED TO START
|
||||||
|
***************************
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Web server failed to start. Port 6060 was already in use.
|
||||||
|
|
||||||
|
Action:
|
||||||
|
|
||||||
|
Identify and stop the process that's listening on port 6060 or configure this application to listen on another port.
|
||||||
|
|
||||||
|
2024-11-15 00:36:45 [background-preinit] INFO o.h.validator.internal.util.Version - HV000001: Hibernate Validator 8.0.1.Final
|
||||||
|
2024-11-15 00:36:45 [main] INFO c.spring.gateway.GatewayApplication - Starting GatewayApplication using Java 21.0.1 with PID 20292 (D:\java\dcaa-mcs\gateway\target\classes started by amaya in D:\java\dcaa-mcs\gateway)
|
||||||
|
2024-11-15 00:36:45 [main] INFO c.spring.gateway.GatewayApplication - No active profile set, falling back to 1 default profile: "default"
|
||||||
|
2024-11-15 00:36:47 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
|
||||||
|
2024-11-15 00:36:47 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 189 ms. Found 1 JPA repository interface.
|
||||||
|
2024-11-15 00:36:47 [main] INFO o.s.cloud.context.scope.GenericScope - BeanFactory id=4cd63aab-9820-3caf-9964-cc499267ba55
|
||||||
|
2024-11-15 00:36:48 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||||
|
2024-11-15 00:36:48 [main] INFO com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@40f1aa95
|
||||||
|
2024-11-15 00:36:48 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||||
|
2024-11-15 00:36:48 [main] INFO o.h.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
|
||||||
|
2024-11-15 00:36:48 [main] INFO org.hibernate.Version - HHH000412: Hibernate ORM core version 6.5.3.Final
|
||||||
|
2024-11-15 00:36:48 [main] INFO o.h.c.i.RegionFactoryInitiator - HHH000026: Second-level cache disabled
|
||||||
|
2024-11-15 00:36:49 [main] INFO o.s.o.j.p.SpringPersistenceUnitInfo - No LoadTimeWeaver setup: ignoring JPA class transformer
|
||||||
|
2024-11-15 00:36:49 [main] WARN org.hibernate.orm.deprecation - HHH90000021: Encountered deprecated setting [hibernate.temp.use_jdbc_metadata_defaults], use [hibernate.boot.allow_jdbc_metadata_access] instead
|
||||||
|
2024-11-15 00:36:49 [main] WARN org.hibernate.orm.deprecation - HHH90000025: PostgreSQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
|
||||||
|
2024-11-15 00:36:50 [main] INFO o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
|
||||||
|
2024-11-15 00:36:50 [main] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.cloud.commons.util.InetUtils - Cannot determine local hostname
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [After]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Before]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Between]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Cookie]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Header]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Host]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Method]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Path]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Query]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [ReadBody]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [RemoteAddr]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [XForwardedRemoteAddr]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [Weight]
|
||||||
|
2024-11-15 00:36:52 [main] INFO o.s.c.g.r.RouteDefinitionRouteLocator - Loaded RoutePredicateFactory [CloudFoundryRouteService]
|
||||||
|
2024-11-15 00:36:55 [main] INFO o.s.cloud.commons.util.InetUtils - Cannot determine local hostname
|
||||||
|
2024-11-15 00:36:55 [main] INFO o.s.b.w.e.netty.NettyWebServer - Netty started on port 6061 (http)
|
||||||
|
2024-11-15 00:36:56 [main] INFO o.s.cloud.commons.util.InetUtils - Cannot determine local hostname
|
||||||
|
2024-11-15 00:36:57 [main] INFO o.s.cloud.commons.util.InetUtils - Cannot determine local hostname
|
||||||
|
2024-11-15 00:36:57 [main] INFO c.spring.gateway.GatewayApplication - Started GatewayApplication in 13.51 seconds (process running for 15.11)
|
||||||
|
2024-11-15 00:40:04 [reactor-http-nio-1] INFO c.s.g.f.CorrelationTrackingPreFilter - Tracking filter invoked...
|
||||||
|
2024-11-15 00:40:04 [reactor-http-nio-1] INFO c.s.g.f.CorrelationTrackingPreFilter - Generated new correlation id: 51ba480f-411b-41c4-8ace-501bf8a0313e
|
||||||
|
2024-11-15 00:40:04 [reactor-http-nio-1] INFO c.s.g.f.CorrelationTrackingPostFilter - Injecting correlation id: 51ba480f-411b-41c4-8ace-501bf8a0313e
|
||||||
|
2024-11-15 00:42:30 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=2m41s953ms938µs100ns).
|
||||||
|
2024-11-15 00:42:30 [reactor-http-nio-1] INFO c.s.g.f.CorrelationTrackingPostFilter - Response status code: 500 INTERNAL_SERVER_ERROR
|
||||||
|
2024-11-15 00:42:47 [SpringApplicationShutdownHook] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-11-15 00:42:47 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
|
||||||
|
2024-11-15 00:42:47 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
|
191
gateway/pom.xml
191
gateway/pom.xml
@ -1,82 +1,119 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.3.4</version>
|
<version>3.3.4</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.spring</groupId>
|
<groupId>com.spring</groupId>
|
||||||
<artifactId>gateway</artifactId>
|
<artifactId>gateway</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>gateway</name>
|
<name>gateway</name>
|
||||||
<description>gateway project</description>
|
<description>gateway project</description>
|
||||||
<url/>
|
<url/>
|
||||||
<licenses>
|
<licenses>
|
||||||
<license/>
|
<license/>
|
||||||
</licenses>
|
</licenses>
|
||||||
<developers>
|
<developers>
|
||||||
<developer/>
|
<developer/>
|
||||||
</developers>
|
</developers>
|
||||||
<scm>
|
<scm>
|
||||||
<connection/>
|
<connection/>
|
||||||
<developerConnection/>
|
<developerConnection/>
|
||||||
<tag/>
|
<tag/>
|
||||||
<url/>
|
<url/>
|
||||||
</scm>
|
</scm>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<spring-cloud.version>2023.0.3</spring-cloud.version>
|
<spring-cloud.version>2023.0.3</spring-cloud.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-logging</artifactId>
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
<scope>test</scope>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
</dependencies>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<dependencyManagement>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<dependencies>
|
<scope>test</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<!-- <dependency>-->
|
||||||
<artifactId>spring-cloud-dependencies</artifactId>
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
<version>${spring-cloud.version}</version>
|
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
|
||||||
<type>pom</type>
|
<!-- </dependency>-->
|
||||||
<scope>import</scope>
|
<dependency>
|
||||||
</dependency>
|
<groupId>org.springframework.boot</groupId>
|
||||||
</dependencies>
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
</dependencyManagement>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-api</artifactId>
|
||||||
|
<version>0.12.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-impl</artifactId>
|
||||||
|
<version>0.12.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-jackson</artifactId>
|
||||||
|
<version>0.12.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>
|
<exclude>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</exclude>
|
</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.spring.gateway.controller;
|
||||||
|
|
||||||
|
import com.spring.gateway.dto.AuthRequest;
|
||||||
|
import com.spring.gateway.service.AuthUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/auth")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthController {
|
||||||
|
private final AuthUtil authUtil;
|
||||||
|
|
||||||
|
@PostMapping("/register")
|
||||||
|
public ResponseEntity<String> register(@RequestBody AuthRequest req) {
|
||||||
|
return ResponseEntity.ok(authUtil.signUp(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
public ResponseEntity<String> login(@RequestBody AuthRequest req) {
|
||||||
|
return ResponseEntity.ok(authUtil.signIn(req));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.spring.gateway.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AuthRequest {
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.spring.gateway.error;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
@ExceptionHandler(ResponseStatusException.class)
|
||||||
|
public ResponseEntity<String> handleResponseStatusException(ResponseStatusException ex) {
|
||||||
|
return ResponseEntity.status(ex.getStatusCode()).body(ex.getReason());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public ResponseEntity<String> handleUnknownException(Exception ex) {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.spring.gateway.error;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
public class UnauthorizedException extends ResponseStatusException {
|
||||||
|
public UnauthorizedException() {
|
||||||
|
super(HttpStatus.UNAUTHORIZED, "Unauthorized");
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnauthorizedException(String message) {
|
||||||
|
super(HttpStatus.UNAUTHORIZED, message);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.spring.gateway.filter;
|
||||||
|
|
||||||
|
|
||||||
|
import com.spring.gateway.error.UnauthorizedException;
|
||||||
|
import com.spring.gateway.model.User;
|
||||||
|
import com.spring.gateway.service.JwtUtil;
|
||||||
|
import com.spring.gateway.service.UserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||||
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||||
|
import org.springframework.core.Ordered;
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class JwtFilter implements GlobalFilter, Ordered {
|
||||||
|
private final JwtUtil jwtUtil;
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||||
|
ServerHttpRequest request = exchange.getRequest();
|
||||||
|
final String uri = request.getURI().toString();
|
||||||
|
if (uri.startsWith("/auth") || uri.contains("swagger") || uri.contains("api-docs")) {
|
||||||
|
return chain.filter(exchange);
|
||||||
|
}
|
||||||
|
if (!request.getHeaders().containsKey("Authorization")) {
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
String token = request.getHeaders().getOrEmpty("Authorization").get(0).substring(7);
|
||||||
|
try {
|
||||||
|
if (jwtUtil.isExpired(token)) {
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
String email = jwtUtil.getSubject(token);
|
||||||
|
Optional<User> user = userService.find(email);
|
||||||
|
if (user.isPresent()) {
|
||||||
|
return chain.filter(exchange);
|
||||||
|
} else {
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
6
gateway/src/main/java/com/spring/gateway/model/Role.java
Normal file
6
gateway/src/main/java/com/spring/gateway/model/Role.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package com.spring.gateway.model;
|
||||||
|
|
||||||
|
public enum Role {
|
||||||
|
USER,
|
||||||
|
ADMIN,
|
||||||
|
}
|
28
gateway/src/main/java/com/spring/gateway/model/User.java
Normal file
28
gateway/src/main/java/com/spring/gateway/model/User.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package com.spring.gateway.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="users")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class User {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private UUID id;
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
private Role role;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.spring.gateway.repository;
|
||||||
|
|
||||||
|
import com.spring.gateway.model.User;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public interface UserRepository extends JpaRepository<User, UUID> {
|
||||||
|
Optional<User> findByEmail(String email);
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.spring.gateway.service;
|
||||||
|
|
||||||
|
import com.spring.gateway.dto.AuthRequest;
|
||||||
|
import com.spring.gateway.model.Role;
|
||||||
|
import com.spring.gateway.model.User;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthUtil {
|
||||||
|
private final UserService userService;
|
||||||
|
private final JwtUtil jwtUtil;
|
||||||
|
private final PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
|
||||||
|
public String signUp(AuthRequest req) {
|
||||||
|
userService.create(
|
||||||
|
req.getEmail(),
|
||||||
|
passwordEncoder.encode(req.getPassword()),
|
||||||
|
Role.USER
|
||||||
|
);
|
||||||
|
return "Success";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String signIn(AuthRequest req) {
|
||||||
|
final User user = userService.find(req.getEmail())
|
||||||
|
.orElseThrow(() -> new RuntimeException("Incorrect email or password"));
|
||||||
|
if (!passwordEncoder.matches(req.getPassword(), user.getPassword())) {
|
||||||
|
throw new RuntimeException("Incorrect email or password");
|
||||||
|
}
|
||||||
|
return jwtUtil.generateToken(user);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.spring.gateway.service;
|
||||||
|
|
||||||
|
import com.spring.gateway.model.User;
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
|
import io.jsonwebtoken.Jwts;
|
||||||
|
import io.jsonwebtoken.io.Decoders;
|
||||||
|
import io.jsonwebtoken.security.Keys;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class JwtUtil {
|
||||||
|
@Value("${jwt.secret-key}")
|
||||||
|
private String SECRET_KEY;
|
||||||
|
|
||||||
|
public String generateToken(User user) {
|
||||||
|
final int expiration = 1000 * 60 * 60; // 1h
|
||||||
|
return Jwts.builder()
|
||||||
|
.subject(user.getEmail())
|
||||||
|
.issuedAt(new Date(System.currentTimeMillis()))
|
||||||
|
.expiration(new Date(System.currentTimeMillis() + expiration))
|
||||||
|
.signWith(getSignInKey(), Jwts.SIG.HS256)
|
||||||
|
.compact();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExpired(String token) {
|
||||||
|
return extractClaim(token, Claims::getExpiration).before(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubject(String token) {
|
||||||
|
return extractClaim(token, Claims::getSubject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SecretKey getSignInKey() {
|
||||||
|
byte[] keyBytes = Decoders.BASE64.decode(SECRET_KEY);
|
||||||
|
return Keys.hmacShaKeyFor(keyBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> T extractClaim(String token, Function<Claims, T> claimsResolver) {
|
||||||
|
final Claims claims = extractAllClaims(token);
|
||||||
|
return claimsResolver.apply(claims);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Claims extractAllClaims(String token) {
|
||||||
|
return Jwts.parser()
|
||||||
|
.verifyWith(getSignInKey())
|
||||||
|
.build()
|
||||||
|
.parseSignedClaims(token)
|
||||||
|
.getPayload();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.spring.gateway.service;
|
||||||
|
|
||||||
|
import com.spring.gateway.model.Role;
|
||||||
|
import com.spring.gateway.model.User;
|
||||||
|
import com.spring.gateway.repository.UserRepository;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UserService {
|
||||||
|
private final UserRepository userRepository;
|
||||||
|
|
||||||
|
public User create(String email, String password, Role role) {
|
||||||
|
final User user = new User(null, email, password, role);
|
||||||
|
return userRepository.save(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<User> find(String email) {
|
||||||
|
return userRepository.findByEmail(email);
|
||||||
|
}
|
||||||
|
}
|
@ -14,15 +14,32 @@ spring:
|
|||||||
filters:
|
filters:
|
||||||
- RewritePath=/rental/(?<path>.*), /$\{path}
|
- RewritePath=/rental/(?<path>.*), /$\{path}
|
||||||
- RemoveRequestHeader=Cookie,Set-Cookie
|
- RemoveRequestHeader=Cookie,Set-Cookie
|
||||||
# - id: report
|
- id: minio
|
||||||
# uri: http://report:8082
|
uri: http://myminio:8081
|
||||||
# predicates:
|
predicates:
|
||||||
# - Path=/report/**
|
- Path=/minio/**
|
||||||
# filters:
|
filters:
|
||||||
# - RewritePath=/report/(?<path>.*), /$\{path}
|
- RewritePath=/minio/(?<path>.*), /${path}
|
||||||
# - RemoveRequestHeader=Cookie,Set-Cookie
|
- RemoveRequestHeader=Cookie,Set-Cookie
|
||||||
|
datasource:
|
||||||
|
url: jdbc:postgresql://localhost:5432/Rental
|
||||||
|
username: role_for_spring
|
||||||
|
password: ${DB_PASSWORD}
|
||||||
|
driver-class-name: org.postgresql.Driver
|
||||||
|
jpa:
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
show_sql: true
|
||||||
|
ddl-auto: validate
|
||||||
|
temp:
|
||||||
|
use_jdbc_metadata_defaults: false
|
||||||
|
|
||||||
management:
|
management:
|
||||||
endpoint:
|
endpoint:
|
||||||
end:
|
end:
|
||||||
exposure:
|
exposure:
|
||||||
include: "*"
|
include: "*"
|
||||||
|
|
||||||
|
jwt:
|
||||||
|
secret-key: 2e292e323124377c78255f363165246b6c7d684a7379445f5c3b713962
|
@ -5,8 +5,17 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="4c468ddb-7fbe-40b8-bf97-16a0c944e8c6" name="Changes" comment="">
|
<list default="true" id="4c468ddb-7fbe-40b8-bf97-16a0c944e8c6" name="Changes" comment="">
|
||||||
|
<change afterPath="$PROJECT_DIR$/../gateway/src/main/java/com/spring/gateway/config/SecurityConfig.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/../gateway/src/main/java/com/spring/gateway/filter/JwtAuthFilter.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/../.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../gateway/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../gateway/pom.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../gateway/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../gateway/src/main/resources/application.yml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/spring/minio/consumer/Consumer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/spring/minio/consumer/Consumer.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/spring/minio/controller/MinioController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/spring/minio/controller/MinioController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../report/logs/application.log" beforeDir="false" afterPath="$PROJECT_DIR$/../report/logs/application.log" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../report/src/main/java/com/spring/report/controller/VisitorController.java" beforeDir="false" afterPath="$PROJECT_DIR$/../report/src/main/java/com/spring/report/controller/VisitorController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../report/src/main/java/com/spring/report/kafka/Producer.java" beforeDir="false" afterPath="$PROJECT_DIR$/../report/src/main/java/com/spring/report/kafka/Producer.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -16,18 +25,18 @@
|
|||||||
<component name="FileTemplateManagerImpl">
|
<component name="FileTemplateManagerImpl">
|
||||||
<option name="RECENT_TEMPLATES">
|
<option name="RECENT_TEMPLATES">
|
||||||
<list>
|
<list>
|
||||||
<option value="Class" />
|
|
||||||
<option value="Dockerfile" />
|
<option value="Dockerfile" />
|
||||||
|
<option value="Class" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||||
</component>
|
</component>
|
||||||
<component name="KubernetesApiPersistence"><![CDATA[{}]]></component>
|
<component name="KubernetesApiPersistence">{}</component>
|
||||||
<component name="KubernetesApiProvider"><![CDATA[{
|
<component name="KubernetesApiProvider">{
|
||||||
"isMigrated": true
|
"isMigrated": true
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="MavenImportPreferences">
|
<component name="MavenImportPreferences">
|
||||||
<option name="generalSettings">
|
<option name="generalSettings">
|
||||||
<MavenGeneralSettings>
|
<MavenGeneralSettings>
|
||||||
@ -61,9 +70,9 @@
|
|||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"Spring Boot.MinioApplication.executor": "Run",
|
"Spring Boot.MinioApplication.executor": "Run",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "lw5",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "D:/учеба/диплом/protege",
|
"last_opened_file_path": "D:/java",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
@ -94,7 +103,9 @@
|
|||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration default="true" type="docker-deploy" factoryName="docker-compose.yml" temporary="true">
|
<configuration default="true" type="docker-deploy" factoryName="docker-compose.yml" temporary="true">
|
||||||
<deployment type="docker-compose.yml" />
|
<deployment type="docker-compose.yml">
|
||||||
|
<settings />
|
||||||
|
</deployment>
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="docker-compose.yml.minio: Compose Deployment" type="docker-deploy" factoryName="docker-compose.yml" temporary="true" server-name="Docker">
|
<configuration name="docker-compose.yml.minio: Compose Deployment" type="docker-deploy" factoryName="docker-compose.yml" temporary="true" server-name="Docker">
|
||||||
@ -141,6 +152,10 @@
|
|||||||
<workItem from="1729271678576" duration="138000" />
|
<workItem from="1729271678576" duration="138000" />
|
||||||
<workItem from="1729432602672" duration="627000" />
|
<workItem from="1729432602672" duration="627000" />
|
||||||
<workItem from="1729705852820" duration="15757000" />
|
<workItem from="1729705852820" duration="15757000" />
|
||||||
|
<workItem from="1729795093249" duration="2507000" />
|
||||||
|
<workItem from="1729940091457" duration="4875000" />
|
||||||
|
<workItem from="1729959483684" duration="1816000" />
|
||||||
|
<workItem from="1730073394292" duration="173000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
@ -60,6 +60,10 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-logging</artifactId>
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.kafka</groupId>
|
||||||
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.spring.minio.config;
|
||||||
|
|
||||||
|
import com.spring.minio.properties.KafkaProperties;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||||
|
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.kafka.annotation.EnableKafka;
|
||||||
|
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||||
|
import org.springframework.kafka.core.ConsumerFactory;
|
||||||
|
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@EnableKafka
|
||||||
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class KafkaConsumerConfig {
|
||||||
|
private final KafkaProperties kafkaProperties;
|
||||||
|
|
||||||
|
private ConsumerFactory<String, byte[]> consumerFactory() {
|
||||||
|
Map<String, Object> props = new HashMap<>();
|
||||||
|
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaProperties.getBootstrapAddress());
|
||||||
|
props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
|
||||||
|
props.put(ConsumerConfig.GROUP_ID_CONFIG, kafkaProperties.getGroupId());
|
||||||
|
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
|
||||||
|
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
|
||||||
|
props.put(ConsumerConfig.MAX_PARTITION_FETCH_BYTES_CONFIG, "20971520");
|
||||||
|
props.put(ConsumerConfig.FETCH_MAX_BYTES_CONFIG, "20971520");
|
||||||
|
return new DefaultKafkaConsumerFactory<>(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ConcurrentKafkaListenerContainerFactory<String, byte[]> kafkaListenerContainerFactory() {
|
||||||
|
ConcurrentKafkaListenerContainerFactory<String, byte[]> factory =
|
||||||
|
new ConcurrentKafkaListenerContainerFactory<>();
|
||||||
|
factory.setConsumerFactory(consumerFactory());
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
}
|
32
minio/src/main/java/com/spring/minio/consumer/Consumer.java
Normal file
32
minio/src/main/java/com/spring/minio/consumer/Consumer.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package com.spring.minio.consumer;
|
||||||
|
|
||||||
|
import com.spring.minio.config.MinioAdapter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
|
import org.springframework.kafka.support.KafkaHeaders;
|
||||||
|
import org.springframework.messaging.handler.annotation.Header;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class Consumer {
|
||||||
|
private final MinioAdapter minioAdapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Слушатель Kafka, который принимает сообщения из заданного топика и обрабатывает их.
|
||||||
|
*
|
||||||
|
* @param message Сообщение, полученное из Kafka.
|
||||||
|
*/
|
||||||
|
@KafkaListener(topics = "test_topic", containerFactory = "kafkaListenerContainerFactory")
|
||||||
|
public void listenGroupTopic(byte[] message, @Header(KafkaHeaders.RECEIVED_KEY) String key) {
|
||||||
|
log.info("Received message with cor-id: " + key);
|
||||||
|
try {
|
||||||
|
minioAdapter.uploadFile("user1", key + " visitors_report.csv", message);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Exception: ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@ -55,7 +56,7 @@ public class MinioController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/download")
|
@GetMapping("/download")
|
||||||
public ResponseEntity<?> get(@RequestPart("file") String file, @RequestHeader(CORRELATION_ID) String correlationId) {
|
public ResponseEntity<?> get(@RequestParam("file") String file, @RequestHeader(CORRELATION_ID) String correlationId) {
|
||||||
log.info(String.format("Trying get file | correlation-id: %s | endpoint: /download | method: GET", correlationId));
|
log.info(String.format("Trying get file | correlation-id: %s | endpoint: /download | method: GET", correlationId));
|
||||||
try {
|
try {
|
||||||
byte[] data = minioAdapter.getFile("user1", file);
|
byte[] data = minioAdapter.getFile("user1", file);
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.spring.minio.properties;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "app.kafka")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class KafkaProperties {
|
||||||
|
/**
|
||||||
|
* Адреса серверов Kafka, к которым будет подключаться потребитель.
|
||||||
|
*/
|
||||||
|
private String bootstrapAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Идентификатор группы потребителей.
|
||||||
|
*/
|
||||||
|
private String groupId;
|
||||||
|
}
|
@ -5,3 +5,8 @@ minio:
|
|||||||
name: role_for_spring
|
name: role_for_spring
|
||||||
secret: 123456789
|
secret: 123456789
|
||||||
url: "http://minio:9000"
|
url: "http://minio:9000"
|
||||||
|
|
||||||
|
app:
|
||||||
|
kafka:
|
||||||
|
bootstrapAddress: kafka:9092
|
||||||
|
groupId: group1
|
2019
report/logs/application-2024-10-24.log
Normal file
2019
report/logs/application-2024-10-24.log
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,16 @@
|
|||||||
2024-10-24 02:44:08 [main] INFO c.s.report.ReportApplicationTests - Starting ReportApplicationTests using Java 17.0.8 with PID 23160 (started by amaya in D:\java\dcaa-mcs\report)
|
2024-10-26 15:46:40 [main] INFO c.s.report.ReportApplicationTests - Starting ReportApplicationTests using Java 17.0.8 with PID 12976 (started by amaya in D:\java\dcaa-mcs\report)
|
||||||
2024-10-24 02:44:08 [main] INFO c.s.report.ReportApplicationTests - No active profile set, falling back to 1 default profile: "default"
|
2024-10-26 15:46:40 [main] INFO c.s.report.ReportApplicationTests - No active profile set, falling back to 1 default profile: "default"
|
||||||
2024-10-24 02:44:10 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
|
2024-10-26 15:46:41 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
|
||||||
2024-10-24 02:44:10 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 64 ms. Found 1 JPA repository interface.
|
2024-10-26 15:46:41 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 76 ms. Found 1 JPA repository interface.
|
||||||
2024-10-24 02:44:11 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
2024-10-26 15:46:42 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||||
2024-10-24 02:44:12 [main] INFO o.h.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
|
2024-10-26 15:46:44 [main] INFO o.h.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
|
||||||
2024-10-24 02:44:12 [main] INFO org.hibernate.Version - HHH000412: Hibernate ORM core version 6.5.3.Final
|
2024-10-26 15:46:44 [main] INFO org.hibernate.Version - HHH000412: Hibernate ORM core version 6.5.3.Final
|
||||||
2024-10-24 02:44:12 [main] INFO o.h.c.i.RegionFactoryInitiator - HHH000026: Second-level cache disabled
|
2024-10-26 15:46:44 [main] INFO o.h.c.i.RegionFactoryInitiator - HHH000026: Second-level cache disabled
|
||||||
2024-10-24 02:44:13 [main] INFO o.s.o.j.p.SpringPersistenceUnitInfo - No LoadTimeWeaver setup: ignoring JPA class transformer
|
2024-10-26 15:46:44 [main] INFO o.s.o.j.p.SpringPersistenceUnitInfo - No LoadTimeWeaver setup: ignoring JPA class transformer
|
||||||
2024-10-24 02:44:13 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
2024-10-26 15:46:44 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||||
2024-10-24 02:44:14 [main] WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 28P01
|
2024-10-26 15:46:46 [main] WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 28P01
|
||||||
2024-10-24 02:44:14 [main] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ?????: ???????????? "role_for_spring" ?? ?????? ???????? ??????????? (?? ??????)
|
2024-10-26 15:46:46 [main] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ?????: ???????????? "role_for_spring" ?? ?????? ???????? ??????????? (?? ??????)
|
||||||
2024-10-24 02:44:14 [main] WARN o.h.e.j.e.i.JdbcEnvironmentInitiator - HHH000342: Could not obtain connection to query metadata
|
2024-10-26 15:46:46 [main] WARN o.h.e.j.e.i.JdbcEnvironmentInitiator - HHH000342: Could not obtain connection to query metadata
|
||||||
org.hibernate.exception.GenericJDBCException: unable to obtain isolated JDBC connection [?????: ???????????? "role_for_spring" ?? ?????? ???????? ??????????? (?? ??????)] [n/a]
|
org.hibernate.exception.GenericJDBCException: unable to obtain isolated JDBC connection [?????: ???????????? "role_for_spring" ?? ?????? ???????? ??????????? (?? ??????)] [n/a]
|
||||||
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:63)
|
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:63)
|
||||||
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
|
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
|
||||||
@ -148,9 +148,186 @@ Caused by: org.postgresql.util.PSQLException: ?????: ???????????? "role_for_spri
|
|||||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:439)
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:439)
|
||||||
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:61)
|
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:61)
|
||||||
... 113 common frames omitted
|
... 113 common frames omitted
|
||||||
2024-10-24 02:44:14 [main] WARN org.hibernate.orm.deprecation - HHH90000025: PostgreSQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
|
2024-10-26 15:46:46 [main] WARN org.hibernate.orm.deprecation - HHH90000025: PostgreSQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
|
||||||
2024-10-24 02:44:15 [main] INFO o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
|
2024-10-26 15:46:47 [main] INFO o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
|
||||||
2024-10-24 02:44:15 [main] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
|
2024-10-26 15:46:47 [main] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
|
||||||
2024-10-24 02:44:16 [main] WARN o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
|
2024-10-26 15:46:48 [main] WARN o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
|
||||||
2024-10-24 02:44:18 [main] INFO c.s.report.ReportApplicationTests - Started ReportApplicationTests in 10.37 seconds (process running for 11.994)
|
2024-10-26 15:46:49 [main] INFO o.a.k.c.admin.AdminClientConfig - AdminClientConfig values:
|
||||||
2024-10-24 02:44:19 [SpringApplicationShutdownHook] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
|
auto.include.jmx.reporter = true
|
||||||
|
bootstrap.controllers = []
|
||||||
|
bootstrap.servers = [kafka:9092]
|
||||||
|
client.dns.lookup = use_all_dns_ips
|
||||||
|
client.id =
|
||||||
|
connections.max.idle.ms = 300000
|
||||||
|
default.api.timeout.ms = 60000
|
||||||
|
enable.metrics.push = true
|
||||||
|
metadata.max.age.ms = 300000
|
||||||
|
metric.reporters = []
|
||||||
|
metrics.num.samples = 2
|
||||||
|
metrics.recording.level = INFO
|
||||||
|
metrics.sample.window.ms = 30000
|
||||||
|
receive.buffer.bytes = 65536
|
||||||
|
reconnect.backoff.max.ms = 1000
|
||||||
|
reconnect.backoff.ms = 50
|
||||||
|
request.timeout.ms = 30000
|
||||||
|
retries = 2147483647
|
||||||
|
retry.backoff.max.ms = 1000
|
||||||
|
retry.backoff.ms = 100
|
||||||
|
sasl.client.callback.handler.class = null
|
||||||
|
sasl.jaas.config = null
|
||||||
|
sasl.kerberos.kinit.cmd = /usr/bin/kinit
|
||||||
|
sasl.kerberos.min.time.before.relogin = 60000
|
||||||
|
sasl.kerberos.service.name = null
|
||||||
|
sasl.kerberos.ticket.renew.jitter = 0.05
|
||||||
|
sasl.kerberos.ticket.renew.window.factor = 0.8
|
||||||
|
sasl.login.callback.handler.class = null
|
||||||
|
sasl.login.class = null
|
||||||
|
sasl.login.connect.timeout.ms = null
|
||||||
|
sasl.login.read.timeout.ms = null
|
||||||
|
sasl.login.refresh.buffer.seconds = 300
|
||||||
|
sasl.login.refresh.min.period.seconds = 60
|
||||||
|
sasl.login.refresh.window.factor = 0.8
|
||||||
|
sasl.login.refresh.window.jitter = 0.05
|
||||||
|
sasl.login.retry.backoff.max.ms = 10000
|
||||||
|
sasl.login.retry.backoff.ms = 100
|
||||||
|
sasl.mechanism = GSSAPI
|
||||||
|
sasl.oauthbearer.clock.skew.seconds = 30
|
||||||
|
sasl.oauthbearer.expected.audience = null
|
||||||
|
sasl.oauthbearer.expected.issuer = null
|
||||||
|
sasl.oauthbearer.jwks.endpoint.refresh.ms = 3600000
|
||||||
|
sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms = 10000
|
||||||
|
sasl.oauthbearer.jwks.endpoint.retry.backoff.ms = 100
|
||||||
|
sasl.oauthbearer.jwks.endpoint.url = null
|
||||||
|
sasl.oauthbearer.scope.claim.name = scope
|
||||||
|
sasl.oauthbearer.sub.claim.name = sub
|
||||||
|
sasl.oauthbearer.token.endpoint.url = null
|
||||||
|
security.protocol = PLAINTEXT
|
||||||
|
security.providers = null
|
||||||
|
send.buffer.bytes = 131072
|
||||||
|
socket.connection.setup.timeout.max.ms = 30000
|
||||||
|
socket.connection.setup.timeout.ms = 10000
|
||||||
|
ssl.cipher.suites = null
|
||||||
|
ssl.enabled.protocols = [TLSv1.2, TLSv1.3]
|
||||||
|
ssl.endpoint.identification.algorithm = https
|
||||||
|
ssl.engine.factory.class = null
|
||||||
|
ssl.key.password = null
|
||||||
|
ssl.keymanager.algorithm = SunX509
|
||||||
|
ssl.keystore.certificate.chain = null
|
||||||
|
ssl.keystore.key = null
|
||||||
|
ssl.keystore.location = null
|
||||||
|
ssl.keystore.password = null
|
||||||
|
ssl.keystore.type = JKS
|
||||||
|
ssl.protocol = TLSv1.3
|
||||||
|
ssl.provider = null
|
||||||
|
ssl.secure.random.implementation = null
|
||||||
|
ssl.trustmanager.algorithm = PKIX
|
||||||
|
ssl.truststore.certificates = null
|
||||||
|
ssl.truststore.location = null
|
||||||
|
ssl.truststore.password = null
|
||||||
|
ssl.truststore.type = JKS
|
||||||
|
|
||||||
|
2024-10-26 15:46:52 [main] WARN o.apache.kafka.clients.ClientUtils - Couldn't resolve server kafka:9092 from bootstrap.servers as DNS resolution failed for kafka
|
||||||
|
2024-10-26 15:46:52 [main] ERROR o.s.kafka.core.KafkaAdmin - Could not create admin
|
||||||
|
org.apache.kafka.common.KafkaException: Failed to create new KafkaAdminClient
|
||||||
|
at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:541)
|
||||||
|
at org.apache.kafka.clients.admin.Admin.create(Admin.java:147)
|
||||||
|
at org.apache.kafka.clients.admin.AdminClient.create(AdminClient.java:49)
|
||||||
|
at org.springframework.kafka.core.KafkaAdmin.createAdmin(KafkaAdmin.java:393)
|
||||||
|
at org.springframework.kafka.core.KafkaAdmin.initialize(KafkaAdmin.java:256)
|
||||||
|
at org.springframework.kafka.core.KafkaAdmin.afterSingletonsInstantiated(KafkaAdmin.java:238)
|
||||||
|
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:986)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
|
||||||
|
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
|
||||||
|
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
|
||||||
|
at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137)
|
||||||
|
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
|
||||||
|
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
|
||||||
|
at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1463)
|
||||||
|
at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:553)
|
||||||
|
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137)
|
||||||
|
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108)
|
||||||
|
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:225)
|
||||||
|
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:152)
|
||||||
|
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130)
|
||||||
|
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)
|
||||||
|
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)
|
||||||
|
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:260)
|
||||||
|
at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:163)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:378)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:383)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:378)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
|
||||||
|
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
|
||||||
|
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
|
||||||
|
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
|
||||||
|
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:377)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:290)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:289)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:279)
|
||||||
|
at java.base/java.util.Optional.orElseGet(Optional.java:364)
|
||||||
|
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:278)
|
||||||
|
at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
|
||||||
|
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:106)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:105)
|
||||||
|
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:69)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
|
||||||
|
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
|
||||||
|
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
|
||||||
|
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
|
||||||
|
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
|
||||||
|
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
|
||||||
|
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
|
||||||
|
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
|
||||||
|
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
|
||||||
|
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
|
||||||
|
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
|
||||||
|
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
|
||||||
|
at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
|
||||||
|
at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
|
||||||
|
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
|
||||||
|
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
|
||||||
|
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
|
||||||
|
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
|
||||||
|
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
|
||||||
|
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
|
||||||
|
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
|
||||||
|
Caused by: org.apache.kafka.common.config.ConfigException: No resolvable bootstrap urls given in bootstrap.servers
|
||||||
|
at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:103)
|
||||||
|
at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:62)
|
||||||
|
at org.apache.kafka.clients.admin.internals.AdminBootstrapAddresses.fromConfig(AdminBootstrapAddresses.java:72)
|
||||||
|
at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:510)
|
||||||
|
... 93 common frames omitted
|
||||||
|
2024-10-26 15:46:53 [main] INFO c.s.report.ReportApplicationTests - Started ReportApplicationTests in 13.011 seconds (process running for 14.902)
|
||||||
|
2024-10-26 15:46:55 [SpringApplicationShutdownHook] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
@ -62,6 +62,10 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-logging</artifactId>
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.kafka</groupId>
|
||||||
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.spring.report.config;
|
||||||
|
|
||||||
|
import org.apache.kafka.clients.admin.AdminClientConfig;
|
||||||
|
import org.apache.kafka.clients.admin.NewTopic;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||||
|
import org.apache.kafka.common.serialization.ByteArraySerializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
||||||
|
import org.springframework.kafka.core.KafkaAdmin;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
|
import org.springframework.kafka.core.ProducerFactory;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.spring.report.kafka.Producer.TEST_TOPIC;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class KafkaProducerConfig {
|
||||||
|
@Value("${kafka.bootstrapAddress}")
|
||||||
|
private String SERVER;
|
||||||
|
|
||||||
|
private ProducerFactory<String, byte[]> producerFactory() {
|
||||||
|
Map<String, Object> configProps = new HashMap<>();
|
||||||
|
configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, SERVER);
|
||||||
|
configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
|
||||||
|
configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class);
|
||||||
|
configProps.put(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, "20971520");
|
||||||
|
return new DefaultKafkaProducerFactory<>(configProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaTemplate<String, byte[]> kafkaTemplate() {
|
||||||
|
return new KafkaTemplate<>(producerFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaAdmin kafkaAdmin() {
|
||||||
|
Map<String, Object> configs = new HashMap<>();
|
||||||
|
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, SERVER);
|
||||||
|
return new KafkaAdmin(configs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public NewTopic testTopic() {
|
||||||
|
return new NewTopic(TEST_TOPIC, 1, (short) 1);
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.spring.report.controller;
|
|||||||
|
|
||||||
import com.opencsv.CSVWriter;
|
import com.opencsv.CSVWriter;
|
||||||
import com.spring.report.entity.Visitor;
|
import com.spring.report.entity.Visitor;
|
||||||
|
import com.spring.report.kafka.Producer;
|
||||||
import com.spring.report.repository.VisitorRepository;
|
import com.spring.report.repository.VisitorRepository;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -22,6 +23,7 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -31,7 +33,7 @@ import java.util.List;
|
|||||||
public class VisitorController {
|
public class VisitorController {
|
||||||
private final VisitorRepository visitorRepository;
|
private final VisitorRepository visitorRepository;
|
||||||
public static final String CORRELATION_ID = "correlation-id";
|
public static final String CORRELATION_ID = "correlation-id";
|
||||||
private final RestTemplate restTemplate;
|
private final Producer producer;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public ResponseEntity<List<Visitor>> report(@RequestHeader(CORRELATION_ID) String correlationId) {
|
public ResponseEntity<List<Visitor>> report(@RequestHeader(CORRELATION_ID) String correlationId) {
|
||||||
@ -84,23 +86,10 @@ public class VisitorController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void uploadFileToMinio(File file, String corId) {
|
private void uploadFileToMinio(File file, String corId) {
|
||||||
String url = "http://myminio:8081/upload";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpHeaders headers = setHeaders(corId);
|
producer.sendEvent(Producer.TEST_TOPIC, corId, Files.readAllBytes(file.toPath()));
|
||||||
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
|
||||||
|
|
||||||
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
|
|
||||||
body.add("file", new FileSystemResource(file));
|
|
||||||
|
|
||||||
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
|
||||||
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
|
|
||||||
|
|
||||||
if (response.getStatusCode() != HttpStatus.OK) {
|
|
||||||
log.error("Failed to upload file: {}", response.getStatusCode());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error uploading file to MinIO", e);
|
log.error("Error uploading file to Kafka", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
report/src/main/java/com/spring/report/kafka/Producer.java
Normal file
33
report/src/main/java/com/spring/report/kafka/Producer.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.spring.report.kafka;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
|
import org.springframework.kafka.support.SendResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class Producer {
|
||||||
|
private final KafkaTemplate<String, byte[]> kafkaTemplateByteArray;
|
||||||
|
public static final String TEST_TOPIC = "test_topic";
|
||||||
|
|
||||||
|
public void sendEvent(final String topic, final String key, final byte[] data) {
|
||||||
|
Assert.hasText(topic, "topic must not be blank");
|
||||||
|
Assert.notNull(data, "data not be null");
|
||||||
|
|
||||||
|
CompletableFuture<SendResult<String, byte[]>> future = kafkaTemplateByteArray.send(topic, key, data);
|
||||||
|
|
||||||
|
future.whenComplete((result, ex) -> {
|
||||||
|
if (ex == null) {
|
||||||
|
log.info("Kafka send complete");
|
||||||
|
} else {
|
||||||
|
log.error("Kafka fail send", ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -12,3 +12,6 @@ spring:
|
|||||||
hibernate:
|
hibernate:
|
||||||
format_sql: true
|
format_sql: true
|
||||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
|
||||||
|
kafka:
|
||||||
|
bootstrapAddress: kafka:9092
|
Loading…
Reference in New Issue
Block a user