Spring Boot REST API startup delay - mysql

When I start up my Spring Boot API (which is running in a Docker container), there's a very long delay between the RepositoryConfigurationDelegate step and the PostProcessorRegistrationDelegate step. I've modified the dates below for readability, but they reflect the roughly 2.5 hour delay I'm seeing:
2023-01-17 08:00:00.123 INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository
scanning in 97 ms. Found 24 JPA repository interfaces.
2023-01-17 10:30:00.123 INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean
'methodSecurityConfig' of type [com.deloitte.tve.MethodSecurityConfig$$EnhancerBySpringCGLIB$$90e69ca] is
not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-01-17 10:30:00.456 INFO o.s.b.w.e.t.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
Any idea what would cause this kind of delay and/or how to troubleshoot it?
Sometimes the Spring Boot API process startup stalls in a similar manner when I run in my local dev environment. Then when I hit [enter] in the terminal it proceeds again.
But in this case, Spring is running in a Docker container. I can shell into the container. From there, is there a way to remotely shell into the startup process itself and essentially do the same thing I do in my dev environment (hit [enter]) to trigger the startup to proceed if/when it hangs?

Related

TIBCO BW failing to debug successfully a REST service .I have created a jdbc resource and tested the connection was a success but i have this error

<>#BWEclipseAppNode> 12:12:32.545 INFO [main] com.tibco.thor.frwk.Deployer - Started by BusinessStudio.
12:12:34.970 INFO [main] com.tibco.bw.frwk.engine.BWEngine - TIBCO-BW-FRWK-300002: BW Engine [Main] started successfully.
12:12:35.355 INFO [Framework Event Dispatcher: Equinox Container: 80edabb3-8e47-001c-18c5-90bdbc610de0] com.tibco.thor.frwk.Deployer - TIBCO-THOR-FRWK-300001: Started OSGi Framework of AppNode [BWEclipseAppNode] in AppSpace [BWEclipseAppSpace] of Domain [BWEclipseDomain]
12:12:35.483 INFO [Framework Event Dispatcher: Equinox Container: 80edabb3-8e47-001c-18c5-90bdbc610de0] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300018: Deploying BW Application [RESTservice2.application:1.0].
12:12:40.067 INFO [Framework Event Dispatcher: Equinox Container: 80edabb3-8e47-001c-18c5-90bdbc610de0] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300021: All Application dependencies are resolved for Application [RESTservice2.application:1.0]
12:12:41.431 INFO [Thread-28] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300019: BW Application [RESTservice2.application:1.0] is impaired.
12:12:41.435 INFO [Framework Event Dispatcher: Equinox Container: 80edabb3-8e47-001c-18c5-90bdbc610de0] com.tibco.thor.frwk.Application - Started by BusinessStudio, ignoring .enabled settings.
12:12:41.438 ERROR [CM Configuration Updater (Update: pid=bw.resource.jdbc.916120c9-fbcb-45de-a13c-b22e3edf76ec)] com.tibco.bw.sharedresource.runtime.dependency.ReferenceDependency - TIBCO-BW-SR-FRWK-503000: Unable to start SharedResource [restservice2.JDBCConnectionResource] from Module [RESTservice2:1.0.0.qualifier], DeploymentUnit [RESTservice2.application:1.0]. <Reason>: TIBCO-BW-SR-JDBC-500003: The database driver [com.mysql.jdbc.Driver] is not found. Ensure that DataSourceFactory bundle providing this driver is available in the environment.
so this is the error i am getting as a result i cant run OSGi commands to request endpoint urls and for my rest service even though my code has no errors before debug ,i am getting this during debug ,please help.
In order to use the MySql JDBC driver you need to install it in the BusinessWorks environment of your machine.
This is done by running the command 'bwinstall mysql-driver' from the <TIBCO_HOME>bw/6.X/bin folder.
As Emmanuel suggested, according to the error, you probably missed the required JDBC driver installation.
Once you execute the command, it will start successfully.

Hibernate reactive No Vert.x context active in aws rds

I randomly receive this exception within my application:
HR000065: No Vert.x context active
java.lang.IllegalStateException: HR000065: No Vert.x context active
2021-11-09T17:12:18.143+02:00 at
org.hibernate.reactive.context.impl.VertxContext.put(VertxContext.java:41)
~[hibernate-reactive-core-1.0.1.Final.jar!/:1.0.1.Final]
2021-11-09T17:12:18.143+02:00 Suppressed:
reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
2021-11-09T17:12:18.143+02:00 Error has been observed at the following
site(s):
2021-11-09T17:12:18.143+02:00 |_ checkpoint ⇢ Handler
com.nflp.processingapplication.main.modules.authentication.controller.PrincipalController#getUserAuthentication()
[DispatcherHandler]
2021-11-09T17:12:18.143+02:00 |_ checkpoint ⇢
com.nflp.processingapplication.main.modules.api.shared.filter.ApiExceptionFilter
It does not always occur, but after a couple of times, I start receiving timeout exceptions on any request to the db, which looks like the connection is never released.
Also, I only receive this error in the prod environment - we are using aws rds, it works perfectly fine locally, even when I create an ssh tunnel to the rds instance and connect to prod db locally.
I only use methods like withTransaction and withSession in my application, so I do not expect it to be an issue with implementation of functionality.
Issue was related to the fact that I was using Stage.Session implementation of the api and converting it into the Reactive Java streams [Flux, Mono]using Mono.fromCompleationStage().
After switching to Mutiny api I was no longer able to reproduce this issue.

Accessing data MySQL. Freezing on build

I am currently following along with this document:
https://spring.io/guides/gs/accessing-data-mysql/
and when I build using Gradle, the process does not finish executing.
20-10-11 18:12:09.099 INFO 4584 --- [task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-10-11 18:12:09.245 INFO 4584 --- [main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-10-11 18:12:09.253 INFO 4584 --- [main] c.e.a.AccessingDataMysqlApplication : Started AccessingDataMysqlApplication in 4.295 seconds (JVM running for 4.699)
<=========----> 75% EXECUTING [4m 32s]
I am new to Spring and starting a project from the ground up and do not know where to begin looking to solve this issue.
You are not just building the application - you are actually running it. And since it is a web application, listening to web requests on localhost:8080/demo, it runs until you exit it with ctrl+c.

Cannot set configuration in Elastic Beanstalk

I have 4 Elastic Beanstalk deployments: 3 are Corretto 8 and the other one is Corretto 11.
On the Corretto 8 deployments, I can set new configuration without issue. On the Corretto 11 instance, however, any attempt to set a new configuration fails and causes a rollback.
The Corretto versions might not be the problem, but it's the only difference I can see. All 4 apps are Spring Boot apps that run as web servers (i.e embedded tomcat with exposed web ports). I am trying to set the exact same configuration name and value, and it only fails on the one instance.
The configuration I'm trying to set is pretty simple:
VALIDATE_RENEWALS = true
Even just trying to set DEBUG = true causes a failure and rollback.
I don't see a lot of information from the console about what's failing. Here is the event log:
2020-03-16 13:55:17 UTC-0600 INFO The environment was reverted to the previous configuration setting.
2020-03-16 13:54:45 UTC-0600 ERROR During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.
2020-03-16 13:54:45 UTC-0600 ERROR Failed to deploy configuration.
2020-03-16 13:54:45 UTC-0600 ERROR Unsuccessful command execution on instance id(s) 'i-00553f4ac36afd327'. Aborting the operation.
2020-03-16 13:54:45 UTC-0600 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-03-16 13:54:45 UTC-0600 ERROR [Instance: i-00553f4ac36afd327] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-03-16 13:54:20 UTC-0600 INFO Updating environment XXX's configuration settings.
2020-03-16 13:54:15 UTC-0600 INFO Environment update is starting.
I've also downloaded the full set of logs for the instance and don't see anything obvious. The app stdout doesn't have any errors or exceptions, it just starts normally and then gets terminated. None of the other log files have messages around the times above, so I'm really not sure what else I can look at.
Edit
The times don't line up but I do see this in eb-engine.log file:
2020/03/16 17:54:38.508634 [INFO] checking whether command is applicable to this instance...
2020/03/16 17:54:38.508658 [INFO] this command is applicable to the instance, thus instance should execute command
2020/03/16 17:54:38.508665 [INFO] check whether this is an enhanced env...
2020/03/16 17:54:38.508794 [INFO] Executing instruction: StageJavaApplication
2020/03/16 17:54:38.508858 [ERROR] GetArchivedFileType with file /opt/elasticbeanstalk/deployment/app_source_bundle failed with error open /opt/elasticbeanstalk/deployment/app_source_bundle: no such file or directory
2020/03/16 17:54:38.508868 [ERROR] An error occurred during execution of command [config-deploy] - [StageJavaApplication]. Stop running the command. Error: staging java app failed with error GetArchivedFileType with file /opt/elasticbeanstalk/deployment/app_source_bundle failed with error open /opt/elasticbeanstalk/deployment/app_source_bundle: no such file or directory

Openshift v3: after starting the SpringBoot / Mysql application the app is killed after a few secs

After building the app, the deployment process works. The SpringBoot (mysql) application is deployed and marked as the usual "Starting the application".
After a few seconds, there is a message saying it "kills" the application. Notice, I am just within the limits of my Openshift free quota.
What is the mesage? .../wildfly/bin/standalone.sh: line 307: 183 Killed "java" -D"[Standalone]"
See the line in bold.
On another time I see is that the application is started, I can even login, but then after a minute is is killed.
14:47:15,334 INFO [nl.xyz.Application] (ServerService Thread Pool --
66) Started Application in 26.49 seconds (JVM running for 57.227)
14:47:15,723 INFO [javax.enterprise.resource.webcontainer.jsf.config]
(ServerService Thread Pool -- 66) Initializing Mojarra 2.2.13.SP1
20160303-1204 for context '' /wildfly/bin/standalone.sh: line 307: 183
Killed "java" -D"[Standalone]" -server -XX:+UseParallelGC -Xms40m
-Xmx250m -XX:+AggressiveOpts -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID= -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djboss.node.name=solvedcaches-5-80fj7 -Djgroups.bind_addr=0.0.0.0 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on "-Dorg.jboss.boot.log.file=/wildfly/standalone/log/server.log"
"-Dlogging.configuration=file:/wildfly/standalone/configuration/logging.properties"
-jar "/wildfly/jboss-modules.jar" -mp "/wildfly/provided_modules:/wildfly/modules" org.jboss.as.standalone
-Djboss.home.dir="/wildfly" -Djboss.server.base.dir="/wildfly/standalone" '-b' '0.0.0.0' '-bmanagement' '0.0.0.0'
The last 2 build failed due to a generic build failture. Strange, the code was hardly changed. It looks like rebuilding takes memory and is competing with the running application and vice versa. The last time I stopped the POD, then deployment was ok.
Thank you #Jiri Fialka for all your help, online / offline.
As you suggested, after configuring the memory over the 2 POD's the application is working fine. Now I use 410 Mb for Mysql and 600 Mb for SpringBoot was WAR on a Wildfly pod. Even SSH was added within minutes!.
I am enthusiastic about the new Openshift v3 facilities. Also the GUI and oc.