i'm army
army computer can install intellij, but can not install H2.
test need h2 or other database program.
i wish know h2 use with 'localhost:8080/h2-console'
thank you for read.
2023-01-05T23:47:23.106+09:00 INFO 6156 --- \[ restartedMain\] anyway.sunwon.SunwonApplication : Starting SunwonApplication using Java 19.0.1 with PID 6156 (C:\\Users\\CKIRUser\\Desktop\\sunwon\\out\\production\\classes started by CKIRUser in C:\\Users\\CKIRUser\\Desktop\\sunwon)
2023-01-05T23:47:23.111+09:00 INFO 6156 --- \[ restartedMain\] anyway.sunwon.SunwonApplication : No active profile set, falling back to 1 default profile: "default"
2023-01-05T23:47:23.187+09:00 INFO 6156 --- \[ restartedMain\] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2023-01-05T23:47:23.187+09:00 INFO 6156 --- \[ restartedMain\] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-01-05T23:47:25.137+09:00 INFO 6156 --- \[ restartedMain\] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-01-05T23:47:25.225+09:00 INFO 6156 --- \[ restartedMain\] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 75 ms. Found 1 JPA repository interfaces.
2023-01-05T23:47:26.289+09:00 INFO 6156 --- \[ restartedMain\] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-01-05T23:47:26.306+09:00 INFO 6156 --- \[ restartedMain\] o.apache.catalina.core.StandardService : Starting service \[Tomcat\]
2023-01-05T23:47:26.306+09:00 INFO 6156 --- \[ restartedMain\] o.apache.catalina.core.StandardEngine : Starting Servlet engine: \[Apache Tomcat/10.1.4\]
2023-01-05T23:47:26.404+09:00 INFO 6156 --- \[ restartedMain\] o.a.c.c.C.\[Tomcat\].\[localhost\].\[/\] : Initializing Spring embedded WebApplicationContext
2023-01-05T23:47:26.406+09:00 INFO 6156 --- \[ restartedMain\] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3217 ms
2023-01-05T23:47:26.509+09:00 INFO 6156 --- \[ restartedMain\] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2023-01-05T23:47:27.118+09:00 INFO 6156 --- \[ restartedMain\] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:testdb user=SA
2023-01-05T23:47:27.120+09:00 INFO 6156 --- \[ restartedMain\] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2023-01-05T23:47:27.129+09:00 INFO 6156 --- \[ restartedMain\] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:testdb'
2023-01-05T23:47:27.392+09:00 INFO 6156 --- \[ restartedMain\] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo \[name: default\]
2023-01-05T23:47:27.459+09:00 INFO 6156 --- \[ restartedMain\] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.1.6.Final
2023-01-05T23:47:27.638+09:00 WARN 6156 --- \[ restartedMain\] org.hibernate.orm.deprecation : HHH90000021: Encountered deprecated setting \[javax.persistence.sharedCache.mode\], use \[jakarta.persistence.sharedCache.mode\] instead
2023-01-05T23:47:27.895+09:00 INFO 6156 --- \[ restartedMain\] SQL dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2023-01-05T23:47:28.487+09:00 INFO 6156 --- \[ restartedMain\] o.h.m.i.EntityInstantiatorPojoStandard : HHH000182: No default (no-argument) constructor for class: anyway.sunwon.domain.Book (class must be instantiated by Interceptor)
2023-01-05T23:47:28.746+09:00 INFO 6156 --- \[ restartedMain\] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: \[org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform\]
2023-01-05T23:47:28.760+09:00 INFO 6156 --- \[ restartedMain\] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-01-05T23:47:29.060+09:00 WARN 6156 --- \[ restartedMain\] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: anyway.sunwon.repository.AdminUserRepository
2023-01-05T23:47:29.178+09:00 WARN 6156 --- \[ restartedMain\] 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
2023-01-05T23:47:29.491+09:00 INFO 6156 --- \[ restartedMain\] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with \[org.springframework.security.web.session.DisableEncodeUrlFilter#7eec5f21, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#79825521, org.springframework.security.web.context.SecurityContextHolderFilter#440b0657, org.springframework.security.web.header.HeaderWriterFilter#67a9dd22, org.springframework.security.web.csrf.CsrfFilter#619d188, org.springframework.security.web.authentication.logout.LogoutFilter#5d875af3, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#1fcb3a64, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#166bfb26, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#3beb7681, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#4632b036, org.springframework.security.web.access.ExceptionTranslationFilter#76fd6789, org.springframework.security.web.access.intercept.AuthorizationFilter#21e50fa\]
2023-01-05T23:47:29.689+09:00 INFO 6156 --- \[ restartedMain\] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2023-01-05T23:47:29.746+09:00 INFO 6156 --- \[ restartedMain\] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-01-05T23:47:29.760+09:00 INFO 6156 --- \[ restartedMain\] anyway.sunwon.SunwonApplication : Started SunwonApplication in 7.529 seconds (process running for 8.562)
HikariProxyConnection#1662029991 wrapping conn0: url=jdbc:h2:mem:testdb user=SA
jdbc:h2:mem:testdb
SA
2023-01-05T23:47:29.792+09:00 INFO 6156 --- \[ restartedMain\] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-01-05T23:47:29.814+09:00 ERROR 6156 --- \[ restartedMain\] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to execute ApplicationRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:761) \~\[spring-boot-3.0.1.jar:3.0.1\]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:748) \~\[spring-boot-3.0.1.jar:3.0.1\]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) \~\[spring-boot-3.0.1.jar:3.0.1\]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) \~\[spring-boot-3.0.1.jar:3.0.1\]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) \~\[spring-boot-3.0.1.jar:3.0.1\]
at anyway.sunwon.SunwonApplication.main(SunwonApplication.java:10) \~\[classes/:na\]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) \~\[na:na\]
at java.base/java.lang.reflect.Method.invoke(Method.java:578) \~\[na:na\]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) \~\[spring-boot-devtools-3.0.1.jar:3.0.1\]
Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar \[INSERT INTO USER VALUES(1, 'testuser')\]
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:101) \~\[spring-jdbc-6.0.3.jar:6.0.3\]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) \~\[spring-jdbc-6.0.3.jar:6.0.3\]
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1538) \~\[spring-jdbc-6.0.3.jar:6.0.3\]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:393) \~\[spring-jdbc-6.0.3.jar:6.0.3\]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:431) \~\[spring-jdbc-6.0.3.jar:6.0.3\]
at anyway.sunwon.H2Runner.run(H2Runner.java:37) \~\[classes/:na\]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:758) \~\[spring-boot-3.0.1.jar:3.0.1\]
... 8 common frames omitted
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "INSERT INTO \[\*\]USER VALUES(1, 'testuser')"; expected "identifier"; SQL statement:
INSERT INTO USER VALUES(1, 'testuser') \[42001-214\]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.message.DbException.getSyntaxError(DbException.java:261) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.readIdentifier(Parser.java:5656) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5616) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.readTableOrView(Parser.java:8328) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.parseInsert(Parser.java:1632) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.parsePrepared(Parser.java:814) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.parse(Parser.java:689) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.parse(Parser.java:661) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.command.Parser.prepareCommand(Parser.java:569) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:631) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:554) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:237) \~\[h2-2.1.214.jar:2.1.214\]
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223) \~\[h2-2.1.214.jar:2.1.214\]
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94) \~\[HikariCP-5.0.1.jar:na\]
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) \~\[HikariCP-5.0.1.jar:na\]
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:422) \~\[spring-jdbc-6.0.3.jar:6.0.3\]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:381) \~\[spring-jdbc-6.0.3.jar:6.0.3\]
... 11 common frames omitted
2023-01-05T23:47:29.853+09:00 INFO 6156 --- \[ restartedMain\] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2023-01-05T23:47:30.061+09:00 WARN 6156 --- \[ restartedMain\] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) \[90121-214\]
2023-01-05T23:47:30.062+09:00 INFO 6156 --- \[ restartedMain\] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2023-01-05T23:47:30.066+09:00 INFO 6156 --- \[ restartedMain\] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
Process finished with exit code 0
Kindly paste your Java program as well.
stmt.executeUpdate("INSERT INTO CUSTOMER (ID,NAME,AGE,ADDRESS,SALARY) VALUES (1, 'Ramesh', 32, 'Ahmedabad', 2000.00 );");
Pasting the working SQL query in my current system, Thanks.
Related
the application stands up but the graphql end point is not produced. I generated this project on start.spring.io but originally settings is the graphql end point not produced
application.yml
datasource:
url: jdbc:postgresql://localhost:10000/postgres
username: admin
password: 12345
graphql:
graphiql:
enabled: true
log
2022-07-07 09:44:40.006 INFO 10960 --- [ restartedMain] c.i.e.EmployeeManagmentApplication : No active profile set, falling back to 1 default profile: "default"
2022-07-07 09:44:40.173 INFO 10960 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-07-07 09:44:40.173 INFO 10960 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-07-07 09:44:41.787 INFO 10960 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2022-07-07 09:44:41.788 INFO 10960 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-07-07 09:44:41.823 INFO 10960 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 13 ms. Found 0 JPA repository interfaces.
2022-07-07 09:44:41.866 INFO 10960 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2022-07-07 09:44:41.869 INFO 10960 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2022-07-07 09:44:41.891 INFO 10960 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 2 ms. Found 0 Redis repository interfaces.
2022-07-07 09:44:43.152 INFO 10960 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-07-07 09:44:43.168 INFO 10960 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-07-07 09:44:43.168 INFO 10960 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.64]
2022-07-07 09:44:43.326 INFO 10960 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-07-07 09:44:43.326 INFO 10960 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3149 ms
2022-07-07 09:44:43.500 INFO 10960 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-07-07 09:44:43.722 INFO 10960 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-07-07 09:44:43.794 INFO 10960 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-07-07 09:44:43.927 INFO 10960 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.9.Final
2022-07-07 09:44:44.284 INFO 10960 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-07-07 09:44:44.547 INFO 10960 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2022-07-07 09:44:44.780 INFO 10960 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-07-07 09:44:44.793 INFO 10960 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-07-07 09:44:44.903 WARN 10960 --- [ restartedMain] 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
2022-07-07 09:44:46.688 INFO 10960 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2022-07-07 09:44:46.779 INFO 10960 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-07-07 09:44:46.805 INFO 10960 --- [ restartedMain] c.i.e.EmployeeManagmentApplication : Started EmployeeManagmentApplication in 7.652 seconds (JVM running for 10.128)```
pom.xml
I am trying to run a basic spring boot application with JPA by using spanner emulator. However, I am getting the below error after startup after hitting any exposed end point.
PERMISSION_DENIED: com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Caller is missing IAM permission spanner.sessions.create on resource projects/test-project/instances/test-instance/databases/test-database.
Project has been cloned from https://github.com/GoogleCloudPlatform/google-cloud-spanner-hibernate/tree/master/google-cloud-spanner-hibernate-samples/spring-data-jpa-sample
and the only change I have done is updated the application.properties file.
as per my understanding spanner emulator should not have any IAM related issues as it doesn't need any. I am not sure what is causing this issue here. I have verified that the emulator config is the active config and hence I would expect the code to connect to emulator.
# Application configuration to use Cloud Spanner with Spring Data JPA
# Spanner connection URL.
# - ${PROJECT_ID} Replace with your GCP project ID
# - ${INSTANCE_ID} Replace with your Spanner instance ID
# - ${DATABASE_NAME} Replace with your Spanner database name within your Spanner instance
spring.datasource.url=jdbc:cloudspanner:/projects/test-project/instances/test-instance/databases/test-database
# Specify the Spanner JDBC driver.
spring.datasource.driver-class-name=com.google.cloud.spanner.jdbc.JdbcDriver
# Specify the Spanner Hibernate dialect.
spring.jpa.properties.hibernate.dialect=com.google.cloud.spanner.hibernate.SpannerDialect
#spring.jpa.hibernate.ddl-auto=update //same error even if I uncomment this line
# Settings to enable batching statements for efficiency
spring.jpa.properties.hibernate.jdbc.batch_size=100
# You may display SQL statements and stats for debugging if needed.
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.format_sql=true
Please find the console logs below:
2021-10-06 12:59:12.549 INFO 9747 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-10-06 12:59:12.556 INFO 9747 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-10-06 12:59:12.556 INFO 9747 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53]
2021-10-06 12:59:12.617 INFO 9747 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-10-06 12:59:12.617 INFO 9747 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 694 ms
2021-10-06 12:59:12.707 INFO 9747 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-10-06 12:59:12.737 WARN 9747 --- [ main] c.g.a.oauth2.DefaultCredentialsProvider : Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
2021-10-06 12:59:14.558 INFO 9747 --- [ main] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Driver does not support get/set network timeout for connections. (Network timeout is not supported)
2021-10-06 12:59:22.165 INFO 9747 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-10-06 12:59:22.197 INFO 9747 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-10-06 12:59:22.231 INFO 9747 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.29.Final
2021-10-06 12:59:22.337 INFO 9747 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-10-06 12:59:22.396 INFO 9747 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: com.google.cloud.spanner.hibernate.SpannerDialect
2021-10-06 12:59:22.851 INFO 9747 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-10-06 12:59:22.857 INFO 9747 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-10-06 12:59:23.060 WARN 9747 --- [ main] 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
2021-10-06 12:59:23.184 INFO 9747 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
2021-10-06 12:59:23.290 INFO 9747 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-10-06 12:59:23.298 INFO 9747 --- [ main] com.example.CoffeeApplication : Started CoffeeApplication in 12.957 seconds (JVM running for 13.227)
2021-10-06 12:59:33.646 INFO 9747 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-10-06 12:59:33.646 INFO 9747 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-10-06 12:59:33.647 INFO 9747 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
Hibernate:
select
customer0_.id as id1_1_,
customer0_.email as email2_1_,
customer0_.name as name3_1_
from
customer customer0_
2021-10-06 12:59:35.650 WARN 9747 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 7, SQLState: null
2021-10-06 12:59:35.650 ERROR 9747 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : PERMISSION_DENIED: com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Caller is missing IAM permission spanner.sessions.create on resource projects/test-project/instances/test-instance/databases/test-database.
2021-10-06 12:59:35.668 ERROR 9747 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: could not extract ResultSet; nested exception is org.hibernate.exception.GenericJDBCException: could not extract ResultSet] with root cause
io.grpc.StatusRuntimeException: PERMISSION_DENIED: Caller is missing IAM permission spanner.sessions.create on resource projects/test-project/instances/test-instance/databases/test-database.
at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.40.1.jar:1.40.1]
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:533) ~[grpc-stub-1.40.1.jar:1.40.1]
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) ~[grpc-api-1.40.1.jar:1.40.1]
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) ~[grpc-api-1.40.1.jar:1.40.1]
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) ~[grpc-api-1.40.1.jar:1.40.1]
at com.google.cloud.spanner.spi.v1.SpannerErrorInterceptor$1$1.onClose(SpannerErrorInterceptor.java:100) ~[google-cloud-spanner-6.12.5.jar:6.12.5]
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:557) ~[grpc-core-1.40.1.jar:1.40.1]
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:69) ~[grpc-core-1.40.1.jar:1.40.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:738) ~[grpc-core-1.40.1.jar:1.40.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:717) ~[grpc-core-1.40.1.jar:1.40.1]
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.40.1.jar:1.40.1]
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.40.1.jar:1.40.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_281]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_281]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_281]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_281]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_281]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_281]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_281]
The error is a clear indication that your application is not trying to connect to the emulator, but to a real Spanner database. In order to connect to the emulator instead of 'real' Cloud Spanner, you should do one of the following:
Set the environment variable SPANNER_EMULATOR_HOST=localhost:9010
OR: Edit the JDBC connection URL to include the autoConfigEmulator=true property. Your JDBC URL would then become jdbc:cloudspanner:/projects/test-project/instances/test-instance/databases/test-database;autoConfigEmulator=true
The advantage of the second alternative is that the autoConfigEmulator property will not only ensure that the JDBC driver is connecting to the emulator, it will also automatically create the test-instance and test-database on the emulator if they do not already exist.
I am now making Spring boot based Web project.
When using AWS EC2 ubuntu for deployment, unsolved error came out and I want to share.
Project stack: Spring boot + AWS (EC2, S3, RDS(MariaDB))
Deployment is run by ubuntu with Spring boot JAR file.
java -jar *.jar
The problem is whenever I start application by JAR file, the server immediately stops with this log. I thought it is because of WebSocketConfig.java for Chat messaging function, but even I added Threadpoooltaskschedule and STOMP setAllowedOrigins, symtoms still exists.
Exhausted with solving by own, I need some help from you guys.
WebSocketConfig.java
private static final Logger LOGGER = LoggerFactory.getLogger(WebsocketBrokerConfig.class);
#Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
//for subscribe prefix
registry.enableSimpleBroker("/user");
//for publish prefix
registry.setApplicationDestinationPrefixes("/app");
//user destination provides ability to have unique user queue
//registry.setUserDestinationPrefix("/user");
}
#Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/broadcast")
.setAllowedOrigins("http://ec2....amazonaws.com")
.withSockJS()
.setHeartbeatTime(60_000);
}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.3)
2021-03-03 00:44:34.278 INFO 5898 --- [ main] com.example.salle.SalleApplication : Starting SalleApplication v0.0.1-SNAPSHOT using Java 1.8.0_282 on ip-172-31-46-33 with PID 5898 (/home/ubuntu/salle/salle/target/test-0.0.1-SNAPSHOT.jar started by ubuntu in /home/ubuntu/salle/salle)
2021-03-03 00:44:34.283 INFO 5898 --- [ main] com.example.salle.SalleApplication : No active profile set, falling back to default profiles: default
2021-03-03 00:44:36.435 INFO 5898 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-03-03 00:44:36.489 INFO 5898 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 31 ms. Found 0 JPA repository interfaces.
2021-03-03 00:44:38.298 INFO 5898 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-03-03 00:44:38.330 INFO 5898 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-03-03 00:44:38.330 INFO 5898 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.43]
2021-03-03 00:44:39.363 INFO 5898 --- [ main] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2021-03-03 00:44:39.969 INFO 5898 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-03-03 00:44:39.969 INFO 5898 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5536 ms
2021-03-03 00:44:41.016 INFO 5898 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-03-03 00:44:41.247 INFO 5898 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-03-03 00:44:41.408 INFO 5898 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-03-03 00:44:41.600 INFO 5898 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.28.Final
2021-03-03 00:44:41.900 INFO 5898 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-03-03 00:44:42.217 INFO 5898 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MariaDB103Dialect
2021-03-03 00:44:43.125 INFO 5898 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
ct.MariaDB103Dialect
2021-03-03 00:44:43.155 INFO 5898 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-03-03 00:44:45.786 INFO 5898 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService
2021-03-03 00:44:45.860 INFO 5898 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'messageBrokerTaskScheduler'
2021-03-03 00:44:46.023 INFO 5898 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'clientInboundChannelExecutor'
2021-03-03 00:44:46.025 INFO 5898 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'clientOutboundChannelExecutor'
2021-03-03 00:44:46.035 INFO 5898 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'brokerChannelExecutor'
2021-03-03 00:44:46.140 WARN 5898 --- [ main] 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
2021-03-03 00:44:47.221 INFO 5898 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-03-03 00:44:47.227 INFO 5898 --- [ main] o.s.m.s.b.SimpleBrokerMessageHandler : Starting...
2021-03-03 00:44:47.227 INFO 5898 --- [ main] o.s.m.s.b.SimpleBrokerMessageHandler : BrokerAvailabilityEvent[available=true, SimpleBrokerMessageHandler [DefaultSubscriptionRegistry[cache[0 destination(s)], registry[0 sessions]]]]
2021-03-03 00:44:47.233 INFO 5898 --- [ main] o.s.m.s.b.SimpleBrokerMessageHandler : Started.
2021-03-03 00:44:47.252 INFO 5898 --- [ main] com.example.salle.SalleApplication : Started SalleApplication in 14.288 seconds (JVM running for 15.469)
2021-03-03 00:45:00.256 INFO 5898 --- [extShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : Stopping...
2021-03-03 00:45:00.258 INFO 5898 --- [extShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : BrokerAvailabilityEvent[available=false, SimpleBrokerMessageHandler [DefaultSubscriptionRegistry[cache[0 destination(s)], registry[0 sessions]]]]
2021-03-03 00:45:00.258 INFO 5898 --- [extShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : Stopped.
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'brokerChannelExecutor'
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'clientOutboundChannelExecutor'
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'clientInboundChannelExecutor'
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'messageBrokerTaskScheduler'
2021-03-03 00:45:00.296 INFO 5898 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-03-03 00:45:00.299 INFO 5898 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...```
The easiest way to put a Spring BOOT app on an EC2 instance is to use Elastic Beanstalk. Read this AWS doc for more details - https://aws.amazon.com/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/
Requirement:
Read from the file containing 100K records.
For each records, retrieve data from IBM DB2 database table and then retrieve data from NuoDB database table.
At last, insert the updated records in the NuoDB database table.
Design approached:
Chunk-oriented processing where 1000 records will be read from the file and processed and written into the database.
Issue:
After approx 75K records and running for almost 5 hours, the batch application failed with the below error:
Hibernate: select ... the SELECT query for DB2
Hibernate: select ... the SELECT query for NuoDB
2020-06-08 22:00:00.187 INFO [ ,,,] 32215 --- [ Thread-9] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#2a7f1f10: startup date [Mon Jun 08 17:22:51 BST 2020]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#3972a855
2020-06-08 22:00:00.192 INFO [ ,,,] 32215 --- [ Thread-9] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2020-06-08 22:00:00.193 INFO [ ,,,] 32215 --- [ Thread-9] o.s.i.endpoint.EventDrivenConsumer : Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2020-06-08 22:00:00.193 INFO [ ,,,] 32215 --- [ Thread-9] o.s.i.channel.PublishSubscribeChannel : Channel ' -1.errorChannel' has 0 subscriber(s).
2020-06-08 22:00:00.193 INFO [ ,,,] 32215 --- [ Thread-9] o.s.i.endpoint.EventDrivenConsumer : stopped _org.springframework.integration.errorLogger
2020-06-08 22:00:00.195 INFO [ ,,,] 32215 --- [ Thread-9] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler'
2020-06-08 22:00:00.196 INFO [ ,,,] 32215 --- [ Thread-9] o.s.jmx.export.MBeanExporter : Unregistering JMX-exposed beans on shutdown
2020-06-08 22:00:00.203 INFO [ ,,,] 32215 --- [ Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-06-08 22:00:00.203 INFO [ ,,,] 32215 --- [ Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-06-08 22:00:00.203 INFO [ ,,,] 32215 --- [ Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-06-08 22:00:00.203 INFO [ ,,,] 32215 --- [ Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-06-08 22:00:00.203 INFO [ ,,,] 32215 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-3 - Shutdown initiated...
2020-06-08 22:00:00.210 INFO [ ,,,] 32215 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-3 - Shutdown completed.
2020-06-08 22:00:00.210 INFO [ ,,,] 32215 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown initiated...
2020-06-08 22:00:00.211 INFO [ ,,,] 32215 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown completed.
2020-06-08 22:00:00.212 INFO [ ,,,] 32215 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-06-08 22:00:00.214 INFO [ ,,,] 32215 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
What can be the actual cause of this issue?
Is this like a database cant be triggered SELECT query for 100K times regularly for 4-6 hours.
I re-run the application with log-level in DEBUG mode and here is the error I got:
com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2030][11211][4.19.72] A communication error occurred during operations on the connection's underlying socket, socket input stream,
or socket output stream. Error location: Command timeout check. Message: Command timed out. ERRORCODE=-4499, SQLSTATE=08001
It seems like your database connection has been lost. You need to restart your job instance. If correctly configured, your job should restart from where it left off after the failure.
I am trying to build my docker image for my spring boot application but keep encountering this error:
:: Spring Boot :: (v2.2.5.RELEASE)
2020-05-31 02:18:39.820 INFO 63 --- [ main] c.g.Apollo.ApolloApplicationTests : Starting ApolloApplicationTests on 4b284b60945e with PID 63 (started by root in /build)
2020-05-31 02:18:39.838 INFO 63 --- [ main] c.g.Apollo.ApolloApplicationTests : No active profile set, falling back to default profiles: default
2020-05-31 02:18:42.208 INFO 63 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-05-31 02:18:42.467 INFO 63 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 216ms. Found 3 JPA repository interfaces.
2020-05-31 02:18:44.902 INFO 63 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-05-31 02:18:46.575 ERROR 63 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.20.jar:8.0.20]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.20.jar:8.0.20]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.20.jar:8.0.20]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.20.jar:8.0.20]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.20.jar:8.0.20]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) ~[mysql-connector-java-8.0.20.jar:8.0.20]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.2.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:354) ~[HikariCP-3.4.2.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202) ~[HikariCP-3.4.2.jar:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473) ~[HikariCP-3.4.2.jar:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:554) ~[HikariCP-3.4.2.jar:na]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.4.2.jar:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.2.jar:na]
Terminal when successfully running in intellij:
:: Spring Boot :: (v2.2.5.RELEASE)
2020-05-31 01:04:39.322 INFO 19524 --- [ restartedMain] c.g.Apollo.ApolloApplication : Starting ApolloApplication on asd-PC with PID 19524 (C:\Projects\Apollo\target\classes started by asd in C:\Projects\Apollo)
2020-05-31 01:04:39.324 INFO 19524 --- [ restartedMain] c.g.Apollo.ApolloApplication : No active profile set, falling back to default profiles: default
2020-05-31 01:04:39.354 INFO 19524 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in C:\Users\asd\.m2\repository\org\glassfish\jaxb\jaxb-runtime\2.3.2\jaxb-runtime-2.3.2.jar referenced one or more files that do not exist: file:/C:/Users/asd/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/jakarta.xml.bind-api-2.3.2.jar,file:/C:/Users/asd/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/txw2-2.3.2.jar,file:/C:/Users/asd/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/istack-commons-runtime-3.0.8.jar,file:/C:/Users/asd/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/stax-ex-1.8.1.jar,file:/C:/Users/asd/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/FastInfoset-1.2.16.jar,file:/C:/Users/asd/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/jakarta.activation-api-1.2.1.jar
2020-05-31 01:04:39.354 INFO 19524 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-05-31 01:04:39.354 INFO 19524 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-05-31 01:04:39.785 INFO 19524 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-05-31 01:04:39.846 INFO 19524 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 54ms. Found 3 JPA repository interfaces.
2020-05-31 01:04:40.214 INFO 19524 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-05-31 01:04:40.220 INFO 19524 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-05-31 01:04:40.221 INFO 19524 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.31]
2020-05-31 01:04:40.293 INFO 19524 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-05-31 01:04:40.293 INFO 19524 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 939 ms
2020-05-31 01:04:40.365 INFO 19524 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-05-31 01:04:40.702 INFO 19524 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-05-31 01:04:40.731 INFO 19524 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-05-31 01:04:40.800 INFO 19524 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.12.Final
2020-05-31 01:04:40.919 INFO 19524 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-05-31 01:04:41.006 INFO 19524 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2020-05-31 01:04:41.407 INFO 19524 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-05-31 01:04:41.413 INFO 19524 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-05-31 01:04:41.650 WARN 19524 --- [ restartedMain] 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
2020-05-31 01:04:41.717 INFO 19524 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-31 01:04:41.967 INFO 19524 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-05-31 01:04:41.995 INFO 19524 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-05-31 01:04:41.997 INFO 19524 --- [ restartedMain] c.g.Apollo.ApolloApplication : Started ApolloApplication in 2.911 seconds (JVM running for 3.899)
My Dockerfile:
FROM maven:3.6.3-jdk-11-slim AS MAVEN_BUILD
COPY pom.xml /build/
COPY src /build/src/
WORKDIR /build/
RUN mvn package
FROM openjdk:11-jre-alpine
WORKDIR /app
COPY --from=MAVEN_BUILD /build/target/*.war /app/app.war
ENTRYPOINT ["java", "-jar", "app.war"]
My application.properties:
## GraphQL SPQR ##
server.port=8080
graphql.spqr.gui.enabled=true
graphql.spqr.http.endpoint=/graphql
graphql.spqr.ws.endpoint=/graphql
## Database Properties ##
spring.datasource.url=jdbc:mysql://localhost:3306/innodb
spring.datasource.username=root
spring.datasource.password=1234
My application works when I build and run the project in Intellij but not when I try and build my docker image. I am using MySQL and have just been connecting on localhost on port 3306.
The error message seems to indicate the issue is failing to connect to the database. From your settings, it appears that you are trying to connect to the DB using localhost:3306. That will not work when you are running the application in a container because docker creates its own network which is separate from you machine’s network. So, localhost in the container does not refer to your machine.
You need to instead setup a docker network that will allow your container to access the database in a specific IP address.
Here is an article with the specifics:
https://nickjanetakis.com/blog/docker-tip-35-connect-to-a-database-running-on-your-docker-host
Note that I have assumed from your post, that the DB is installed in your host machine. If it is not and the DB is running in its own container, the you need to create a docker network and attach both containers to that network.
I had the same issue and resolved it by changing localhost to the service name on which MySQL was running.
Below is my docker-compose and application.properties files
docker-compose.yml
version: '3.8'
services:
app:
container_name: tvms
build:
context: .
dockerfile: Dockerfile
tty: true
volumes:
- ../..:/workspaces:cached
ports:
- 8990:8990
networks:
- impaq
links:
- db:db
db:
image: percona:8.0
privileged: true
restart: always
container_name: standalone-mysql
environment:
MYSQL_ROOT_PASSWORD: ****
volumes:
- perconadata:/var/lib/mysql
ports:
- 3306:3306
networks:
- impaq
networks:
impaq:
volumes:
perconadata:
application.propeties
#datasource
spring.datasource.url=jdbc:mysql://db:3306/db_name
spring.datasource.username=root
spring.datasource.password=*****
For me below solution worked
change your datasource url from
This:
spring.datasource.url=jdbc:mysql://localhost:3306/innodb
To:
spring.datasource.url=jdbc:mysql://localhost:3306/innodb?useSSL=false