I deployed a springboot application package in WAR format. But I am not seeing the spring related logs in my console. Also, I cannot see the application running. What could be the possible reason? I am attaching the tomcat logs herewith. Thanks in advance
2020-07-02 17:22:17.744 INFO 17952 --- [ost-startStop-1] c.s.narayaneeyam.ServletInitializer : Starting ServletInitializer v0.0.1-SNAPSHOT on DESKTOP-PB6GB90 with PID 17952 (D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\narayaneeyam-0.0.1-SNAPSHOT\WEB-INF\classes started by sachi in D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\bin)
2020-07-02 17:22:17.754 INFO 17952 --- [ost-startStop-1] c.s.narayaneeyam.ServletInitializer : No active profile set, falling back to default profiles: default
2020-07-02 17:22:20.982 INFO 17952 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-07-02 17:22:21.248 INFO 17952 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 227ms. Found 4 JPA repository interfaces.
2020-07-02 17:22:22.688 INFO 17952 --- [ost-startStop-1] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4795 ms
2020-07-02 17:22:23.760 INFO 17952 --- [ost-startStop-1] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-07-02 17:22:23.944 INFO 17952 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-07-02 17:22:24.042 WARN 17952 --- [ost-startStop-1] 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-07-02 17:22:24.172 INFO 17952 --- [ost-startStop-1] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 3c2c7634-78d3-4015-ab8e-c9a6c99c4b3b
2020-07-02 17:22:24.288 INFO 17952 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.17.Final
2020-07-02 17:22:25.162 INFO 17952 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-07-02 17:22:25.745 INFO 17952 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-07-02 17:22:26.474 INFO 17952 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-07-02 17:22:26.573 INFO 17952 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2020-07-02 17:22:26.621 INFO 17952 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#2e78fc6, org.springframework.security.web.context.SecurityContextPersistenceFilter#5adbbfc, org.springframework.security.web.header.HeaderWriterFilter#5e4ef05f, org.springframework.security.web.csrf.CsrfFilter#6f946b3c, org.springframework.security.web.authentication.logout.LogoutFilter#61bb46d, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#5dcf9e1a, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#5a5ac80e, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#4fb155f8, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#54779eb2, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#39715673, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#6708ba7c, org.springframework.security.web.session.SessionManagementFilter#53fa3c7e, org.springframework.security.web.access.ExceptionTranslationFilter#e50c54, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#50b9a845]
2020-07-02 17:22:29.827 INFO 17952 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-07-02 17:22:29.865 INFO 17952 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-07-02 17:22:29.994 INFO 17952 --- [ost-startStop-1] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-07-02 17:22:30.060 INFO 17952 --- [ost-startStop-1] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositoriesà
2020-07-02 17:22:31.170 INFO 17952 --- [ost-startStop-1] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-07-02 17:22:31.187 INFO 17952 --- [ost-startStop-1] c.s.narayaneeyam.ServletInitializer : Started ServletInitializer in 14.858 seconds (JVM running for 42.474)
02-Jul-2020 17:22:31.264 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\narayaneeyam-0.0.1-SNAPSHOT.war] has finished in [41,103] ms
02-Jul-2020 17:22:31.283 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\docs]
02-Jul-2020 17:22:31.316 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\docs] has finished in [33] ms
02-Jul-2020 17:22:31.316 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\examples]
02-Jul-2020 17:22:32.114 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\examples] has finished in [798] ms
02-Jul-2020 17:22:32.115 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\host-manager]
02-Jul-2020 17:22:32.155 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\host-manager] has finished in [40] ms
02-Jul-2020 17:22:32.156 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\manager]
02-Jul-2020 17:22:32.201 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\manager] has finished in [45] ms
02-Jul-2020 17:22:32.201 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\ROOT]
02-Jul-2020 17:22:32.236 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Tomcat\apache-tomcat-8.5.56-windows-x64\apache-tomcat-8.5.56\webapps\ROOT] has finished in [35] ms
02-Jul-2020 17:22:32.242 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
02-Jul-2020 17:22:32.257 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 42167 ms
These are are all spring's logs:
2020-07-02 17:22:20.982 INFO 17952 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-07-02 17:22:21.248 INFO 17952 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 227ms. Found 4 JPA repository interfaces.
2020-07-02 17:22:26.621 INFO 17952 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#2e78fc6, org.springframework.security.web.context.SecurityContextPersistenceFilter#5adbbfc, org.springframework.security.web.header.HeaderWriterFilter#5e4ef05f, org.springframework.security.web.csrf.CsrfFilter#6f946b3c, org.springframework.security.web.authentication.logout.LogoutFilter#61bb46d, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#5dcf9e1a, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#5a5ac80e, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#4fb155f8, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#54779eb2, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#39715673, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#6708ba7c, org.springframework.security.web.session.SessionManagementFilter#53fa3c7e, org.springframework.security.web.access.ExceptionTranslationFilter#e50c54, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#50b9a845]
2020-07-02 17:22:29.994 INFO 17952 --- [ost-startStop-1] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
o.s.d.r.c means org.springframework.data.repository.config
o.s.s.web means org.springframework.security.web
So these are all logs from Spring's classes.
If you want to see more spring logs, just set the log level to debug in application.yaml:
logging:
level:
org.springframework.boot: debug
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 having some issues in regards to my spring boot microservice, I have been able to successfully connect my microservice to my SQL instance running on Google Cloud, but for some reason when I try to test if the controllers are working using a sample endpoint which simply returns a String "Working" I get a 404 not found error, I have also tried a sample blank project, with no dependency except the ones needed to get Spring Boot up and running, however I still face the same problem, that is I get a 404 Not Found error, even though it is properly compiling and running. I have checked my firewall and it has not blocked the service.
Here is the Controller
VideoController.java
package com.example.demo.Controllers;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class VideoController {
#RequestMapping(path = "/test")
public String index() {
return "Greetings from Spring Boot!";
}
}
Run Logs
2021-07-11 16:53:28.677 INFO 16456 --- [ main] com.example.demo.Run.DemoApplication : Starting DemoApplication using Java 15.0.2 on DESKTOP-OO1339O with PID 16456 (C:\Users\Engineering\IdeaProjects\gcp-demo\build\classes\java\main started by Engineering in C:\Users\Engineering\IdeaProjects\gcp-demo)
2021-07-11 16:53:28.679 INFO 16456 --- [ main] com.example.demo.Run.DemoApplication : No active profile set, falling back to default profiles: default
2021-07-11 16:53:29.149 INFO 16456 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-07-11 16:53:29.161 INFO 16456 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5 ms. Found 0 JPA repository interfaces.
2021-07-11 16:53:29.510 INFO 16456 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-07-11 16:53:29.517 INFO 16456 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-07-11 16:53:29.517 INFO 16456 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.48]
2021-07-11 16:53:29.624 INFO 16456 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-07-11 16:53:29.625 INFO 16456 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 913 ms
2021-07-11 16:53:29.751 INFO 16456 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-07-11 16:53:29.788 INFO 16456 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2021-07-11 16:53:29.888 INFO 16456 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-07-11 16:53:29.971 INFO 16456 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-07-11 16:53:30.025 INFO 16456 --- [ main] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:30.025 INFO 16456 --- [ main] c.g.cloud.sql.core.CoreSocketFactory : First Cloud SQL connection, generating RSA key pair.
2021-07-11 16:53:31.820 INFO 16456 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-07-11 16:53:31.835 INFO 16456 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect
2021-07-11 16:53:31.924 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:32.035 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:32.040 INFO 16456 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-07-11 16:53:32.049 INFO 16456 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-07-11 16:53:32.099 WARN 16456 --- [ 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-07-11 16:53:32.147 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:32.245 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:32.265 INFO 16456 --- [ main] c.g.c.s.core.DefaultCredentialsProvider : Default credentials provider for service account acn-demo-app#involuted-earth-319307.iam.gserviceaccount.com
2021-07-11 16:53:32.265 INFO 16456 --- [ main] c.g.c.s.core.DefaultCredentialsProvider : Scopes in use by default credentials: [https://www.googleapis.com/auth/pubsub, https://www.googleapis.com/auth/spanner.admin, https://www.googleapis.com/auth/spanner.data, https://www.googleapis.com/auth/datastore, https://www.googleapis.com/auth/sqlservice.admin, https://www.googleapis.com/auth/devstorage.read_only, https://www.googleapis.com/auth/devstorage.read_write, https://www.googleapis.com/auth/cloudruntimeconfig, https://www.googleapis.com/auth/trace.append, https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/cloud-vision, https://www.googleapis.com/auth/bigquery, https://www.googleapis.com/auth/monitoring.write]
2021-07-11 16:53:32.277 INFO 16456 --- [ main] c.g.c.s.a.c.GcpContextAutoConfiguration : The default project ID is XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST
2021-07-11 16:53:32.353 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:32.378 INFO 16456 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-07-11 16:53:32.389 INFO 16456 --- [ main] com.example.demo.Run.DemoApplication : Started DemoApplication in 4.027 seconds (JVM running for 4.567)
2021-07-11 16:53:32.449 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:32.554 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:32.659 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [involuted-earth-319307:australia-southeast1:cloud-demo] via SSL socket.
2021-07-11 16:53:32.768 INFO 16456 --- [onnection adder] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [XXXXXXXXHIDDENFROMSTACKOVERFLOWPOST] via SSL socket.
2021-07-11 16:53:38.167 INFO 16456 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-07-11 16:53:38.167 INFO 16456 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-07-11 16:53:38.168 INFO 16456 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
My Application Properties File
Application.properties
spring.main.allow-bean-definition-overriding=true
spring.datasource.url=SOMEVALUE HERE
spring.datasource.username=SOMEVALUE HERE
spring.datasource.password=SOMEVALUEHERE
spring.cloud.gcp.sql.database-name=SOMEVALUEHERE
spring.cloud.gcp.sql.instance-connection-name=SOMVEVALUEHERE
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
My File Structure
My Application Run Class
DemoApplication.Java
package com.example.demo.Run;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
DemoApplication is in the com.example.demo.Run package. This means that its component scanning, enabled via #SpringBootApplication, will find components in com.example.demo.Run and in any sub-packages such as com.example.demo.Run.example. The rest of your code, therefore, isn’t in a package where it’ll be found.
I would fix this by moving DemoApplication up into the com.example.demo package. This will mean that components in any of your existing com.example.demo.* packages is found.
Alternatively, you could leave DemoApplication where it is and use the scanBasePackages attribute on #SpringBootApplication to list all your other com.example.demo.* packages. This will be more verbose than moving DemoApplication and would require changes every time you introduce a new package.
As you said your first problem was because of the package level of your main class and Controller class. But the second problem does not seem to depend on refactoring the main class. It's related to conflict of the version of your JDK or another library
My issue is quite similar to this one and it's kinda straightforward: copy paste service from maven to gradle project makes starters non operational.
Here is the project I've used as an example and it starts like a charm:
Spring-Boot: (v2.2.5.RELEASE)
Camunda BPM: (v7.12.0)
Camunda BPM Spring Boot Starter: (v3.4.1)
INFO 227460 --- [main] com.camunda.demo.springboot.Application : Starting Application on archbox with PID 227460 (/home/user/ide/IdeaProjects/camunda-spring-boot-amqp-microservice-cloud-example/target/classes started by user in /home/user/ide/IdeaProjects/camunda-spring-boot-amqp-microservice-cloud-example)
INFO 227460 --- [main] com.camunda.demo.springboot.Application : No active profile set, falling back to default profiles: default
INFO 227460 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO 227460 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 227460 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.31]
INFO 227460 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
INFO 227460 --- [main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1095 ms
INFO 227460 --- [main] .c.b.s.b.s.r.CamundaJerseyResourceConfig : Configuring camunda rest api.
INFO 227460 --- [main] .c.b.s.b.s.r.CamundaJerseyResourceConfig : Finished configuring camunda rest api.
INFO 227460 --- [main] org.camunda.bpm.spring.boot : STARTER-SB040 Setting up jobExecutor with corePoolSize=3, maxPoolSize:10
INFO 227460 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'camundaTaskExecutor'
INFO 227460 --- [main] org.camunda.bpm.engine.cfg : ENGINE-12003 Plugin 'CompositeProcessEnginePlugin[genericPropertiesConfiguration, camundaEngineHistoryConfiguration, camundaIdGeneratorConfiguration, camundaProcessEngineConfiguration, camundaDatasourceConfiguration, camundaJobConfiguration, camundaHistoryConfiguration, camundaMetricsConfiguration, camundaAuthorizationConfiguration, failedJobConfiguration, SendEventListenerPlugin, disableDeploymentResourcePattern, eventPublisherPlugin]' activated on process engine 'default'
INFO 227460 --- [main] org.camunda.bpm.spring.boot : STARTER-SB020 ProcessApplication enabled: autoDeployment via springConfiguration#deploymentResourcePattern is disabled
INFO 227460 --- [main] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-001: Initialized Camunda Spring Boot Eventing Engine Plugin.
INFO 227460 --- [main] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-003: Task events will be published as Spring Events.
INFO 227460 --- [main] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-005: Execution events will be published as Spring Events.
INFO 227460 --- [main] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-007: History events will be published as Spring events.
INFO 227460 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
INFO 227460 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
INFO 227460 --- [main] org.camunda.bpm.engine : ENGINE-00001 Process Engine default created.
INFO 227460 --- [main] o.c.b.s.b.s.w.f.LazyInitRegistration : lazy initialized org.camunda.bpm.spring.boot.starter.webapp.filter.LazyProcessEnginesFilter#69364b2d
INFO 227460 --- [main] o.c.b.s.b.s.w.f.LazyInitRegistration : lazy initialized org.camunda.bpm.spring.boot.starter.webapp.filter.LazySecurityFilter#52f6900a
However project I've copied from part of sources gives following:
Spring-Boot: (v2.1.3.RELEASE)
Camunda BPM: (v7.12.0)
Camunda BPM Spring Boot Starter: (v3.4.1)
INFO 227891 --- [main] com.test.camundatest.Application : Starting Application on archbox with PID 227891 (/home/user/ide/IdeaProjects/gradle-camunda-service/build/classes/java/main started by user in /home/user/ide/IdeaProjects/gradle-camunda-service)
INFO 227891 --- [main] com.test.camundatest.Application : No active profile set, falling back to default profiles: default
INFO 227891 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
INFO 227891 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
INFO 227891 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14ms. Found 0 repository interfaces.
INFO 227891 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
INFO 227891 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
INFO 227891 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 3ms. Found 0 repository interfaces.
INFO 227891 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d980ca4f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO 227891 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO 227891 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 227891 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]
INFO 227891 --- [main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
INFO 227891 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
INFO 227891 --- [main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1883 ms
ERROR 227891 --- [main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthIndicatorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthIndicatorRegistry]: Factory method 'healthIndicatorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.camunda.bpm.engine.spring.SpringProcessEngineServicesConfiguration': Unsatisfied dependency expressed through field 'processEngine'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.camunda.bpm.spring.boot.starter.CamundaBpmAutoConfiguration$ProcessEngineConfigurationImplDependingConfiguration': Unsatisfied dependency expressed through field 'processEngineConfigurationImpl'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
INFO 227891 --- [main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
WARN 227891 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
INFO 227891 --- [main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-06 10:21:45.754 ERROR 227891 --- [main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field processEngineConfigurationImpl in org.camunda.bpm.spring.boot.starter.CamundaBpmAutoConfiguration$ProcessEngineConfigurationImplDependingConfiguration required a bean of type 'org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'processEngineConfigurationImpl' in 'CamundaBpmConfiguration' not loaded because #ConditionalOnMissingBean (types: org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; SearchStrategy: all) found beans of type 'org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl' processEngineConfiguration
Action:
Consider revisiting the entries above or defining a bean of type 'org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl' in your configuration.
What should I add / change in configs to make my "gradle" service work like "maven" one?
Surprisingly there's key difference in the way that two given projects retrieving connection and data source details.
For instance it's enough for me to put this into maven project properties to point camunda engine to my db (rest left "as-is"):
spring.datasource.url=${POSTGRES_ADDRESS:jdbc:postgresql://localhost:5432/myservice}
spring.datasource.username=${POSTGRES_USER:postgres}
spring.datasource.password=${POSTGRES_PASSWORD:12345}
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
while same config just doesn't work for gradle completely, obscurely complaining about processEngineConfigurationImpl bean absence when all what engine needs is database connection details.
So that's what I figured:
#Configuration
#ImportResource({"classpath:config.xml"})
public class Config {
#Value("${spring.datasource.url}")
private String url;
#Value("${spring.datasource.username}")
private String username;
#Value("${spring.datasource.password}")
private String password;
#Bean
public DataSource dataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("org.postgresql.Driver");
dataSource.setUrl(url);
dataSource.setUsername(username);
dataSource.setPassword(password);
return dataSource;
}
#Bean
public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(dataSource());
}
#Bean
public ProcessEngineConfigurationImpl processEngineConfiguration() throws IOException {
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
config.setDataSource(dataSource());
config.setTransactionManager(transactionManager());
config.setDatabaseSchemaUpdate("true");
config.setJobExecutorActivate(true);
config.setAuthorizationEnabled(true);
config.setDefaultSerializationFormat("application/json");
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
config.setDeploymentResources(resolver.getResources("classpath:/bpmn/*.bpmn"));
List<ProcessEnginePlugin> processEnginePlugins = new ArrayList<>();
config.setProcessEnginePlugins(processEnginePlugins);
return config;
}
}
And it works:
Spring-Boot: (v2.1.3.RELEASE)
Camunda BPM: (v7.13.0)
Camunda BPM Spring Boot Starter: (v7.13.0)
INFO 378753 --- [main] com.myname.myservice.Application : Starting Application on pc with PID 378753 (/home/user/IdeaProjects/myservice/build/classes/java/main started by user in /home/user/IdeaProjects/myservice)
INFO 378753 --- [main] com.myname.myservice.Application : No active profile set, falling back to default profiles: default
INFO 378753 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
INFO 378753 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
INFO 378753 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 7ms. Found 0 repository interfaces.
INFO 378753 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
INFO 378753 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
INFO 378753 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 7ms. Found 0 repository interfaces.
INFO 378753 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.kafka.annotation.KafkaBootstrapConfiguration' of type [org.springframework.kafka.annotation.KafkaBootstrapConfiguration$$EnhancerBySpringCGLIB$$f04798b1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO 378753 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$1c95872e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO 378753 --- [main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 5.2.4 by Boxfuse
INFO 378753 --- [main] o.f.c.internal.database.DatabaseFactory : Database: jdbc:postgresql://localhost:5432/myservice (PostgreSQL 12.1)
WARN 378753 --- [main] o.f.c.internal.database.base.Database : Flyway upgrade recommended: PostgreSQL 12.1 is newer than this version of Flyway and support has not been tested.
INFO 378753 --- [main] o.f.core.internal.command.DbValidate : Successfully validated 2 migrations (execution time 00:00.010s)
INFO 378753 --- [main] o.f.core.internal.command.DbMigrate : Current version of schema "public": 1
INFO 378753 --- [main] o.f.core.internal.command.DbMigrate : Schema "public" is up to date. No migration necessary.
INFO 378753 --- [main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
INFO 378753 --- [main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.7.Final}
INFO 378753 --- [main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
INFO 378753 --- [main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
INFO 378753 --- [main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL95Dialect
INFO 378753 --- [main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000422: Disabling contextual LOB creation as connection was null
INFO 378753 --- [main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#642c6461
INFO 378753 --- [main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
INFO 378753 --- [main] org.camunda.feel.FeelEngine : Engine created. [value-mapper: CompositeValueMapper(List(org.camunda.feel.impl.JavaValueMapper#a047bdb)), function-provider: org.camunda.bpm.dmn.feel.impl.scala.function.CustomFunctionTransformer#173b1af1, configuration: Configuration(false)]
INFO 378753 --- [main] org.camunda.bpm.engine : ENGINE-00001 Process Engine default created.
INFO 378753 --- [main] org.camunda.bpm.engine.jobexecutor : ENGINE-14014 Starting up the JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor].
INFO 378753 --- [ultJobExecutor]] org.camunda.bpm.engine.jobexecutor : ENGINE-14018 JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor] starting to acquire jobs
INFO 378753 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'asyncExecutor'
INFO 378753 --- [main] i.micrometer.influx.InfluxMeterRegistry : publishing metrics to influx every 1m
INFO 378753 --- [main] org.camunda.bpm.spring.boot : STARTER-SB040 Setting up jobExecutor with corePoolSize=3, maxPoolSize:10
INFO 378753 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'camundaTaskExecutor'
INFO 378753 --- [main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler'
INFO 378753 --- [main] n.d.b.g.s.s.GrpcServerLifecycle : gRPC Server started, listening on address: *, port: 8081
INFO 378753 --- [main] org.camunda.bpm.container : ENGINE-08024 Found processes.xml file at file:/home/user/IdeaProjects/myservice/build/resources/main/META-INF/processes.xml
INFO 378753 --- [main] org.camunda.bpm.container : ENGINE-08023 Deployment summary for process archive 'application':
As a sidenote - for unknown reason sql dialect is very important for bpm so this one is mandatory to set like this:
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQL95Dialect
and not to forget to please flyway if used:
spring.flyway.baseline-on-migrate = true
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
I want to deploy jhipster registry war on tomcat, deployment is successful but I am unable to access the url. I tried http://localhost:8080/jhipster-registry-2.5.8/ and http://localhost:8761/#/ neither worked. I know that default port for registry is 8761, Does Tomcat overwrites it?
2017-02-23 10:19:05.782 INFO 89248 --- [ost-startStop-1] i.g.jhipster.registry.ApplicationWebXml : The following profiles are active: prod
2017-02-23 10:19:08.230 WARN 89248 --- [ost-startStop-1] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance #Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static #Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider decl
2017-02-23 10:19:09.221 DEBUG 89248 --- [ost-startStop-1] i.g.j.r.config.MetricsConfiguration : Registering JVM gauges
2017-02-23 10:19:09.258 DEBUG 89248 --- [ost-startStop-1] i.g.j.r.config.MetricsConfiguration : Initializing Metrics JMX reporting
2017-02-23 10:19:12.162 INFO 89248 --- [ost-startStop-1] i.g.j.registry.config.WebConfigurer : Web application configuration, using profiles: [prod]
2017-02-23 10:19:12.176 DEBUG 89248 --- [ost-startStop-1] i.g.j.registry.config.WebConfigurer : Initializing Metrics registries
2017-02-23 10:19:12.188 DEBUG 89248 --- [ost-startStop-1] i.g.j.registry.config.WebConfigurer : Registering Metrics Filter
2017-02-23 10:19:12.190 DEBUG 89248 --- [ost-startStop-1] i.g.j.registry.config.WebConfigurer : Registering Metrics Servlet
2017-02-23 10:19:12.198 DEBUG 89248 --- [ost-startStop-1] i.g.j.registry.config.WebConfigurer : Registering Caching HTTP Headers Filter
2017-02-23 10:19:12.200 INFO 89248 --- [ost-startStop-1] i.g.j.registry.config.WebConfigurer : Web application fully configured
2017-02-23 10:19:12.227 INFO 89248 --- [ost-startStop-1] i.g.jhipster.registry.JHipsterRegistry : Running with Spring profile(s) : [prod]
2017-02-23 10:19:15.853 INFO 89248 --- [ost-startStop-1] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data.
2017-02-23 10:19:15.883 INFO 89248 --- [ost-startStop-1] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1487863155883 with initial instances count: 0
2017-02-23 10:19:16.072 INFO 89248 --- [ost-startStop-1] c.n.eureka.DefaultEurekaServerContext : Initializing ...
2017-02-23 10:19:16.075 INFO 89248 --- [ost-startStop-1] c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8761/eureka/]
2017-02-23 10:19:16.313 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2017-02-23 10:19:16.321 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2017-02-23 10:19:16.321 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2017-02-23 10:19:16.322 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2017-02-23 10:19:16.802 INFO 89248 --- [ost-startStop-1] c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8761/eureka/
2017-02-23 10:19:16.836 INFO 89248 --- [ost-startStop-1] c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
2017-02-23 10:19:16.838 INFO 89248 --- [ost-startStop-1] c.n.eureka.DefaultEurekaServerContext : Initialized
2017-02-23 10:19:21.092 WARN 89248 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2017-02-23 10:19:21.097 INFO 89248 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2017-02-23 10:19:21.116 WARN 89248 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2017-02-23 10:19:21.117 INFO 89248 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2017-02-23 10:19:23.779 INFO 89248 --- [ Thread-13] c.n.e.r.PeerAwareInstanceRegistryImpl : Got 1 instances from neighboring DS node
2017-02-23 10:19:23.794 INFO 89248 --- [ Thread-13] c.n.e.r.PeerAwareInstanceRegistryImpl : Renew threshold is: 1
2017-02-23 10:19:23.801 INFO 89248 --- [ Thread-13] c.n.e.r.PeerAwareInstanceRegistryImpl : Changing status to UP
2017-02-23 10:19:23.854 INFO 89248 --- [ost-startStop-1] i.g.jhipster.registry.ApplicationWebXml : Started ApplicationWebXml in 21.486 seconds (JVM running for 40.931)
2017-02-23 10:19:23.938 INFO 89248 --- [ost-startStop-1] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2017-02-23 10:19:24.045 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2017-02-23 10:19:24.052 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2017-02-23 10:19:24.052 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2017-02-23 10:19:24.053 INFO 89248 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
23-Feb-2017 10:19:25.047 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\apache-tomcat-8.0.39\webapps\jhipster-registry-2.5.war has finished in 36,797 ms
23-Feb-2017 10:19:25.060 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.39\webapps\docs
23-Feb-2017 10:19:25.110 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\apache-tomcat-8.0.39\webapps\docs has finished in 50 ms
23-Feb-2017 10:19:25.111 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.39\webapps\examples
23-Feb-2017 10:19:25.530 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\apache-tomcat-8.0.39\webapps\examples has finished in 419 ms
23-Feb-2017 10:19:25.530 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.39\webapps\host-manager
23-Feb-2017 10:19:25.578 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\apache-tomcat-8.0.39\webapps\host-manager has finished in 48 ms
23-Feb-2017 10:19:25.580 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.39\webapps\manager
23-Feb-2017 10:19:25.606 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\apache-tomcat-8.0.39\webapps\manager has finished in 27 ms
23-Feb-2017 10:19:25.607 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.39\webapps\ROOT
23-Feb-2017 10:19:25.636 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\apache-tomcat-8.0.39\webapps\ROOT has finished in 28 ms
23-Feb-2017 10:19:25.644 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
23-Feb-2017 10:19:25.663 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
23-Feb-2017 10:19:25.666 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 41071 ms
2017-02-23 10:20:22.433 DEBUG 89248 --- [apr-8080-exec-9] i.g.j.r.s.Http401UnauthorizedEntryPoint : Pre-authenticated entry point called. Rejecting access
2017-02-23 10:20:23.804 INFO 89248 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 0ms
2017-02-23 10:21:23.804 INFO 89248 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 1ms
I reproduced your setup and got same problems.
Weird thing is that running
curl http://admin:admin#localhost:8080/jhipster-registry-2.5.8/
works fine: I get the home page contents.
So something does not work in the browser.
Using another port than 8761 and a context path different than / (in your case /jhipster-registry-2.5.8/) means that you must modify several application properties in registry's application*.yml and also the bootstrap.yml files from all your services and gateways registering with this registry.
To avoid this, I changed tomcat's port to 8761 and renamed the registry war file to ROOT.war but it still does not work.
To make it work would require some significant effort in debugging. So, I highly recommend that you stick to the recommended usage: either using java -jar jhipster-registry.war or using docker.