I'm trying to build an instance of start.spring.io to use it in an air-gaped network. I have been working on it for three weeks and still I don't understand well what to do.
I have cloned start.spring.io from GitHub in a host connected to Internet.
There I can build the application without errors:
./mvnw clean install -DskipTests=true
Then if I true to run the application (../mwnw spring-boot:run from the start-site directory), I get the following error when the application starts, I mean is not an error trying to generate a project, and the application dies:
2022-12-19 17:53:21.170 INFO 2701 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2022-12-19 17:53:21.264 WARN 2701 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [io.spring.initializr.web.controller.ProjectGenerationController] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader#5cb0d902]
2022-12-19 17:53:21.272 INFO 2701 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-12-19 17:53:21.311 INFO 2701 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-12-19 17:53:21.411 ERROR 2701 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [io.spring.initializr.web.controller.ProjectGenerationController] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader#5cb0d902]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$
...
So, I am not adding any special dependencies or initilializr dependencies other than those already included in the project. I use Java 17 from Bell Soft.
I am not about the Spring Boot version but I haven't modified anything in the project. The pom file in the top directory includes:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
</parent>
About my dependencies I am using the initializer-bom:0.20.0-SNAPSHOT. I have also tried with other versions like 0.13.0 and 0.12.0 but the build fails in both cases for the start-site:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /workspaces/start.spring.io.ori/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudContractKotlinDslGradleBuildCustomizer.java:[44,22] cannot find symbol
symbol: method snippets()
location: variable build of type io.spring.initializr.generator.buildsystem.gradle.GradleBuild
[ERROR] /workspaces/start.spring.io.ori/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/HibernatePluginGroovyDslGradleBuildCustomizer.java:[39,22] cannot find symbol
symbol: method snippets()
location: variable build of type io.spring.initializr.generator.buildsystem.gradle.GradleBuild
[ERROR] /workspaces/start.spring.io.ori/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudContractGroovyDslGradleBuildCustomizer.java:[36,22] cannot find symbol
symbol: method snippets()
location: variable build of type io.spring.initializr.generator.buildsystem.gradle.GradleBuild
[INFO] 3 errors
I wonder if this effort makes sense. If I manage to build the application, will I be able of generating code or does the application connect to somewhere else to retrieve the data required to generate the code?
I would appreciate any hints. Thanks
I will write my (potential) answer here, even though I don't really think that is a real answer but too big to make it as a comment.
My setup:
Amazon Coretto JDK 17 https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html (it is not JDK 17 from Bell Soft)
Windows 11 Home
So I went to https://github.com/spring-io/start.spring.io and cloned it.
git clone https://github.com/spring-io/start.spring.io.git
Then I went in the root directoy of the cloned project and ran following command:
./mvnw clean install
Here I got some errors while running the tests, but this shouldn't be way too tragic - I think they failed for me, because it tries to run some gradlew commands but they do fail, because I don't have Gradle installed on my PC, as I am always using the Gradle Wrapper.
Then I started the Spring Boot Application.
cd start-site
../mvnw spring-boot:run
The Spring Boot Application started:
022-12-20T15:01:03.510+01:00 INFO 16592 --- [ restartedMain] io.spring.start.site.StartApplication : No active profile set, falling back to 1 default profile: "default"
2022-12-20T15:01:03.573+01:00 INFO 16592 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-12-20T15:01:03.573+01:00 INFO 16592 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-12-20T15:01:04.800+01:00 INFO 16592 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-12-20T15:01:04.809+01:00 INFO 16592 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-12-20T15:01:04.810+01:00 INFO 16592 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.1]
2022-12-20T15:01:04.872+01:00 INFO 16592 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-12-20T15:01:04.873+01:00 INFO 16592 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1298 ms
2022-12-20T15:01:05.371+01:00 INFO 16592 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2022-12-20T15:01:05.823+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.metadata' created in EhcacheManager.
2022-12-20T15:01:05.832+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.metadata
2022-12-20T15:01:05.832+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.metadata
2022-12-20T15:01:05.835+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.dependency-metadata' created in EhcacheManager.
2022-12-20T15:01:05.836+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.dependency-metadata
2022-12-20T15:01:05.836+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.dependency-metadata
2022-12-20T15:01:05.839+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.project-resources' created in EhcacheManager.
2022-12-20T15:01:05.841+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.project-resources
2022-12-20T15:01:05.841+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.project-resources
2022-12-20T15:01:05.843+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.templates' created in EhcacheManager.
2022-12-20T15:01:05.843+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.templates
2022-12-20T15:01:05.844+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.templates
2022-12-20T15:01:06.026+01:00 INFO 16592 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2022-12-20T15:01:06.031+01:00 INFO 16592 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2022-12-20T15:01:06.078+01:00 INFO 16592 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-12-20T15:01:06.089+01:00 INFO 16592 --- [ restartedMain] io.spring.start.site.StartApplication : Started StartApplication in 3.056 seconds (process running for 3.444)
2022-12-20T15:01:17.890+01:00 INFO 16592 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-12-20T15:01:17.891+01:00 INFO 16592 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-12-20T15:01:17.892+01:00 INFO 16592 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
2022-12-20T15:01:18.122+01:00 INFO 16592 --- [io-8080-exec-10] .s.SaganInitializrMetadataUpdateStrategy : Fetching Spring Boot metadata from https://spring.io/project_metadata/spring-boot
If I now call http://localhost:8080/ - it works, I didn't do absolutely nothing.
Could it maybe be your JDK? I mean the JDKs are similar but not the same... And you also asked:
I wonder if this effort makes sense. If I manage to build the
application, will I be able of generating code or does the application
connect to somewhere else to retrieve the data required to generate
the code? I would appreciate any hints. Thanks
I personally think, it could make sense but - as soon as I generated a project on my own Spring Initializr, I watched the console of the Spring Boot Application and could see the following log:
Fetching Spring Boot metadata from https://spring.io/project_metadata/spring-boot
So it looks, like this thing actually fetches data from the internet, now I don't know what options you have but I have two in mind.
You could try to fork the GitHub Project and try to remove this network call (if this is really the only one) - I couldn't see anything more in the logs atleast... The actual response of the Call looks pretty simple though:
{"id":"spring-boot","name":"Spring Boot","projectReleases":[{"version":"3.0.1-SNAPSHOT","versionDisplayName":"3.0.1-SNAPSHOT","current":false,"releaseStatus":"SNAPSHOT","snapshot":true},{"version":"3.0.0","versionDisplayName":"3.0.0","current":true,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.7.7-SNAPSHOT","versionDisplayName":"2.7.7-SNAPSHOT","current":false,"releaseStatus":"SNAPSHOT","snapshot":true},{"version":"2.7.6","versionDisplayName":"2.7.6","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.6.14","versionDisplayName":"2.6.14","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.5.14","versionDisplayName":"2.5.14","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.4.13","versionDisplayName":"2.4.13","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false}]}
You allow explicitly the URL https://spring.io/project_metadata/spring-boot to fetch data inside of your Air Gap Network (I don't know if this is viable though)
I hope this helps a bit?
There are many dependencies that start from the initializer for spring-boot. If you try to build within an air-gapped network, you will not have access to maven's repository for the dependencies. Try building the package outside the network, and capture the libraries required. Look to your ~/.m2/ folder for the copies of the libraries needed. I would recommend setting up a Nexus repository, and it will capture the libraries as you need them from an open network which you can then use on the air-gapped network.
If this is a secured network, you'll have to have all those files vetted and scanned before you can get them into the air-gapped network. Plan for this.
As you add additional annotations or dependencies, you will have to get them from maven central again. It's not ideal, but you might find someone who setup a project to include all spring-boot dependencies for just this situation.
Also, use the STS dev environment, and build your spring-boot to run with included libraries.
I am trying to create multitenant application with single db and seperate schemas for tenants. And I don't want to loose my data after every startup. This is my application.properties file
logging.level.root=info
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:multi-tenant
spring.jpa.hibernate.ddl-auto=update
spring.liquibase.change-log=classpath:db/changelog/changelog-master.xml
And here is my logs
Connected to the target VM, address: '127.0.0.1:53999', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.2)
2022-08-11 13:02:28.342 INFO 25732 --- [ main] c.l.multitenant.MultiTenantApplication : Starting MultiTenantApplication using Java 18.0.1.1 on Manu with PID 25732 (D:\JAVA\multi-tenant - updated\target\classes started by itsma in D:\JAVA\multi-tenant - updated)
2022-08-11 13:02:28.342 INFO 25732 --- [ main] c.l.multitenant.MultiTenantApplication : No active profile set, falling back to 1 default profile: "default"
2022-08-11 13:02:29.534 INFO 25732 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-08-11 13:02:29.613 INFO 25732 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 53 ms. Found 1 JPA repository interfaces.
2022-08-11 13:02:30.507 INFO 25732 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-08-11 13:02:30.522 INFO 25732 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-08-11 13:02:30.522 INFO 25732 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-08-11 13:02:30.742 INFO 25732 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-08-11 13:02:30.742 INFO 25732 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2321 ms
2022-08-11 13:02:30.993 INFO 25732 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-08-11 13:02:31.286 INFO 25732 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-08-11 13:02:31.302 INFO 25732 --- [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:multi-tenant'
2022-08-11 13:02:31.893 INFO 25732 --- [ main] liquibase.database : Set default schema name to PUBLIC
2022-08-11 13:02:32.253 INFO 25732 --- [ main] liquibase.lockservice : Successfully acquired change log lock
2022-08-11 13:02:32.929 INFO 25732 --- [ main] liquibase.changelog : Creating database history table with name: PUBLIC.DATABASECHANGELOG
2022-08-11 13:02:32.929 INFO 25732 --- [ main] liquibase.changelog : Reading from PUBLIC.DATABASECHANGELOG
Running Changeset: db/changelog/changelog-v1.0.xml::1::manu
2022-08-11 13:02:33.102 INFO 25732 --- [ main] liquibase.changelog : SQL in file db/changelog/data/data.sql executed
2022-08-11 13:02:33.102 INFO 25732 --- [ main] liquibase.changelog : ChangeSet db/changelog/changelog-v1.0.xml::1::manu ran successfully in 32ms
2022-08-11 13:02:33.117 INFO 25732 --- [ main] liquibase.lockservice : Successfully released change log lock
2022-08-11 13:02:33.321 INFO 25732 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-08-11 13:02:33.384 INFO 25732 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.10.Final
2022-08-11 13:02:33.525 INFO 25732 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-08-11 13:02:33.682 INFO 25732 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2022-08-11 13:02:34.138 INFO 25732 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-08-11 13:02:34.138 INFO 25732 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-08-11 13:02:34.530 WARN 25732 --- [ 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
2022-08-11 13:02:35.064 INFO 25732 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator'
2022-08-11 13:02:35.143 INFO 25732 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-08-11 13:02:35.174 INFO 25732 --- [ main] c.l.multitenant.MultiTenantApplication : Started MultiTenantApplication in 7.407 seconds (JVM running for 8.296)
2022-08-11 13:02:37.086 INFO 25732 --- [nio-8080-exec-7] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-08-11 13:02:37.086 INFO 25732 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-08-11 13:02:37.087 INFO 25732 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
Why is ddl-auto=update not working?
You use an in memory database configuration.
This means that when the application starts up an embedded database will be created not in permanent memory but in RAM.
This also means that when the application is shut down the memory it took in RAM is cleaned, therefore any information relative with this database is also lost.
H2 database offers another configuration in the url which will make sure that the data that database holds, is not stored in RAM but in permanent storage HDD. This way the application could be shut down and the data which the database contained, will not be lost.
The database however will stop functioning when the application is shut down, as the process that runs the database belongs to the main process of starting your application. But when the application starts up again and database process is started also, the database will see all the data that it contained before the application was shutdown.
The config is the following:
spring.datasource.url= jdbc:h2:/data/multi-tenant;AUTO_SERVER=TRUE
Multiple processes can access the same database without having to
start the server manually. To do that, append ;AUTO_SERVER=TRUE to the
database URL. You can use the same database URL independent of whether
the database is already open or not. This feature doesn't work with
in-memory databases.
Use the same URL for all connections to this database. Internally,
when using this mode, the first connection to the database is made in
embedded mode, and additionally a server is started internally (as a
daemon thread). If the database is already open in another process,
the server mode is used automatically. The IP address and port of the
server are stored in the file .lock.db, that's why in-memory databases
can't be supported.
The application that opens the first connection to the database uses
the embedded mode, which is faster than the server mode. Therefore the
main application should open the database first if possible. The first
connection automatically starts a server on a random port. This server
allows remote connections, however only to this database (to ensure
that, the client reads .lock.db file and sends the random key that is
stored there to the server). When the first connection is closed, the
server stops. If other (remote) connections are still open, one of
them will then start a server (auto-reconnect is enabled
automatically).
All processes need to have access to the database files. If the first
connection is closed (the connection that started the server), open
transactions of other connections will be rolled back (this may not be
a problem if you don't disable autocommit). Explicit client/server
connections (using jdbc:h2:tcp:// or ssl://) are not supported. This
mode is not supported for in-memory databases.
H2 Documentation
Recently we are facing an issue that we cannot start our Spring Shell app on our Heroku worker node anymore. Directly after the shell app has started the console just prints java.lang.NullPointerException a million times (like there is kina a loop that is trying to instantiate a bean or something which is failing all the time).
Here is an excerpt:
Running /env.sh java -jar ops.jar on ⬢ foo... up, worker.8633 (Standard-1X)
2022-03-04 07:44:37.221 INFO 5 --- [ main] ...Application : Starting Application v1.0.0-SNAPSHOT using Java 11.0.11 on 2e0b87b1-cecd-4720-8c27-4d39afba9615 with PID 5 (/ops.jar started by u27375 in /)
2022-03-04 07:44:37.226 INFO 5 --- [ main] ...Application : No active profile set, falling back to 1 default profile: "default"
2022-03-04 07:44:38.012 INFO 5 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-03-04 07:44:38.129 INFO 5 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 110 ms. Found 10 JPA repository interfaces.
2022-03-04 07:44:38.886 INFO 5 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-03-04 07:44:38.948 INFO 5 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.5.Final
2022-03-04 07:44:39.127 INFO 5 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-03-04 07:44:39.547 INFO 5 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-03-04 07:44:39.929 INFO 5 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-03-04 07:44:39.948 INFO 5 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2022-03-04 07:44:41.089 INFO 5 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-03-04 07:44:41.098 INFO 5 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-03-04 07:44:42.590 INFO 5 --- [ main] ...Application : Started Application in 5.939 seconds (JVM running for 6.39)
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
...
We use Spring Boot v2.6.4 and Spring Shell v2.0.1.RELEASE. The Spring Shell app is containerized (Docker) and we usually start it with:
heroku run --type worker -a foo -- /env.sh java -jar ops.jar
Does anyone of you guys have some tips or something on how to solve or even how to debug this further, i.e., to print the whole stacktrace of the exception?
Could this be something related to JLine in a way that in cannot be used in a Docker container together with Heroku?! However, this worked like a charm in the past.
As said, we appreciate any hint or tip on how to debug this further.
Cheers
i'm testing the empty Vaadin project generated from the "Get Started" page (here)
I'm facing very slow startup time (up to 6 minutes) and i'm not really understanding what's going on, i tried setting vaadin.servlet.productionMode=true but it doesn't solve the issue.
Is there a way to produce a more verbose startup log? Below you can find the current log.
2020-02-13 09:18:14.399 INFO 12084 --- [ restartedMain] it.my-project.Application : Starting Application on XCR10248 with PID 12084 (C:\Dev\workspace-eclipse-2019\my-project\target\classes started by cr10248 in C:\Dev\workspace-eclipse-2019\my-project)
2020-02-13 09:18:14.399 INFO 12084 --- [ restartedMain] it.my-project.Application : No active profile set, falling back to default profiles: default
2020-02-13 09:18:14.446 INFO 12084 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-02-13 09:18:14.446 INFO 12084 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-02-13 09:18:15.868 INFO 12084 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-02-13 09:18:15.872 INFO 12084 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-02-13 09:18:15.872 INFO 12084 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2020-02-13 09:18:16.326 INFO 12084 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-02-13 09:18:16.326 INFO 12084 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1880 ms
2020-02-13 09:18:19.373 INFO 12084 --- [ restartedMain] c.v.f.s.VaadinServletContextInitializer : Search for subclasses and classes with annotations took 2 seconds
2020-02-13 09:18:19.381 INFO 12084 --- [ restartedMain] c.v.f.server.startup.DevModeInitializer : Starting dev-mode updaters in C:\Dev\workspace-eclipse-2019\my-project folder.
2020-02-13 09:18:19.412 INFO 12084 --- [ restartedMain] dev-updater : Visited 94 classes. Took 31 ms.
2020-02-13 09:18:19.444 INFO 12084 --- [ restartedMain] dev-updater : Skipping `npm install`.
2020-02-13 09:18:19.444 INFO 12084 --- [ restartedMain] dev-updater : Copying frontend resources from jar files ...
2020-02-13 09:18:19.819 INFO 12084 --- [ restartedMain] dev-updater : Visited 12 resources. Took 372 ms.
2020-02-13 09:18:19.850 INFO 12084 --- [ restartedMain] dev-updater : No js modules to update 'C:\Dev\workspace-eclipse-2019\my-project\target\frontend\generated-flow-imports.js' file
2020-02-13 09:24:48.821 INFO 12084 --- [ restartedMain] dev-webpack : Starting webpack-dev-server, port: 63432 dir: C:\Dev\workspace-eclipse-2019\my-project
2020-02-13 09:24:48.951 INFO 12084 --- [ restartedMain] dev-webpack : Running webpack to compile frontend resources. This may take a moment, please stand by...
2020-02-13 09:25:18.986 INFO 12084 --- [ restartedMain] dev-webpack : Webpack startup and compilation completed in 30165ms
2020-02-13 09:25:19.211 INFO 12084 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-02-13 09:25:19.649 INFO 12084 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-02-13 09:25:19.836 INFO 12084 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-02-13 09:25:19.836 INFO 12084 --- [ restartedMain] it.my-project.Application : Started Application in 425.889 seconds (JVM running for 427.06)
Thanks
Davide
I answer my own question since i found (at least i hope :D) the "solution".
Like almost ALWAYS, Eclipse didn't manage to understand what's going on with project generated static resources (JS files in this case) and for some reason a full build seems to be performed every time, resulting in long waitings.
Simply doing a F5 on project root did the trick and now the startup takes 5 seconds.
Hope this could help other developers.
I want to start the Spring Boot Admin server on a different port than 8080.
So I configured the server.port property in the bootstrap.yml file with 9000, but still the server listens on port 8080 according to the log file.
Here's my bootstrap.yml:
server:
port: 9000
spring:
application:
name: admin-server
cloud:
config:
uri: http://localhost:8888
And this is the final part of the console log:
2018-11-29 15:52:11.242 INFO 25999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-29 15:52:11.271 INFO 25999 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-11-29 15:52:11.274 INFO 25999 --- [ main] n.d.d.c.a.AdminServerApplication : Started AdminServerApplication in 2.826 seconds (JVM running for 3.355)
2018-11-29 15:52:11.818 INFO 25999 --- [on(4)-127.0.0.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-11-29 15:52:11.819 INFO 25999 --- [on(4)-127.0.0.1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-11-29 15:52:11.830 INFO 25999 --- [on(4)-127.0.0.1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 11 ms
In the application.properties file put this
server.port = 9000
A flashlight in my brain told me I might have forgotten to add the spring-cloud-config-client dependency, after checking, and then adding the appropriate dependency to the pom.xml, it worked like a charm:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
Thanks to all for providing feedback.
Many different configuration sources have precedence over application.properties (or YAML) as described here: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
You might need to verify if one of those sources are not interfering with the value of serve.port.