Failed to shut down 1 bean with phase value x within timeout of 30000: - spring-boot

I am using spring boot 1.5.8. I have configured 2 jms listeners. When I am trying to shut down gracefully using kill sigterm, I'm getting this exception.
13-06-2018 13:21:16 :: WARN :: defaultValueForJmsMessageId::[Thread-2] :: Failed to shut down 1 bean with phase value 2147483647 within timeout of 30000: [org.springframework.jms.config.internalJmsListenerEndpointRegistry]
13-06-2018 13:21:19 :: ERROR :: defaultValueForJmsMessageId::[AMQP Connection 10.23.219.62:5672] :: An unexpected connection driver error occured
java.lang.NoClassDefFoundError: com/rabbitmq/utility/Utility
at com.rabbitmq.client.impl.ChannelN.broadcastShutdownSignal(ChannelN.java:273)
at com.rabbitmq.client.impl.ChannelN.finishProcessShutdownSignal(ChannelN.java:291)
at com.rabbitmq.client.impl.ChannelN.access$000(ChannelN.java:50)
at com.rabbitmq.client.impl.ChannelN$1.transformReply(ChannelN.java:588)
at com.rabbitmq.client.impl.ChannelN$1.transformReply(ChannelN.java:585)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.handleCommand(AMQChannel.java:356)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:149)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:634)
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.rabbitmq.utility.Utility
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 common frames omitted
13-06-2018 13:21:29 :: WARN :: defaultValueForJmsMessageId::[Thread-2] :: Invocation of destroy method failed on bean with name 'rabbitConnectionFactory': java.lang.NoClassDefFoundError: com/rabbitmq/client/impl/SocketFrameHandler$1

This has happened when the application was not given enough time to stop and when restart happened immediately after the deployment of updated spring boot jar in same location.
This has not happened after giving enough time. Will update if something comes up.

Related

How to ignore mongo when start application

A legacy Spring boot project, before it used mongo, but now it does not need. Now start this project it has this error
2022-10-27 14:10:13.119 [cluster-ClusterId{value='635a20bb714f8f71e2e5d041', description='null'}-10.48.51.21:40010] [INFO] [org.mongodb.driver.cluster] - Exception in monitor thread while connecting to server 10.48.51.21:40010
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70)
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:127)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
then I exclude related Auto Configuration class
#SpringBootApplication(exclude={MongoAutoConfiguration.class, MongoRepositoriesAutoConfiguration.class,MongoDataAutoConfiguration.class})
but this time project start failed
***************************
APPLICATION FAILED TO START
***************************
Description:
Field mongoTemplate in com.bxt.bmht_support.dao.BmhtMideTableDao required a bean of type 'org.springframework.data.mongodb.core.MongoTemplate' that could not be found.
How to disable mongo without update current code? just want ignore it.

NiFi registry failed to run

I am trying to set up a Secure Apache NiFi Registry on Windows machine, following below link: https://community.cloudera.com/t5/Community-Articles/Setting-Up-a-Secure-Apache-NiFi-Registry/ta-p/247753
Unfortunately, to start the server when I am executing the command: run-nifi-registry.bat start
following error comes up:
Failed to start web server: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
Shutting down...
I am unable to understand the problem, please explain and provide the solution. Thank You in advance!
Solution: Change the JAVA_HOME to JAVA 1.8
Your JDK may be on higher version and new JDK does not come with JAXB classes
The
Below is sample error log message if JDK is higher version
2020-07-30 13:19:54,998 ERROR [main] o.springframework.boot.SpringApplication Application run failed
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3167)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2310)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489)
... 63 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:555)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 67 common frames omitted
2020-07-30 13:19:57,811 INFO [Thread-0] org.apache.nifi.registry.NiFiRegistry Initiating shutdown of Jetty web server...
2020-07-30 13:19:57,823 INFO [Thread-0] o.eclipse.jetty.server.AbstractConnector Stopped ServerConnector#5223e5ee{HTTP/1.1,[http/1.1]}{0.0.0.0:18080}
2020-07-30 13:19:57,823 INFO [Thread-0] org.eclipse.jetty.server.session node0 Stopped scavenging

Quarkus migration, rest endpoints test problem - TestInstantiationException because of IllegalArgumentException

I am migrating application to quarkus. To current point with success. But I meet a problem which currently I can not bypass. I have rest endpoints and when I run app they are working perfectly. But when I am trying to use quarkus test framework to test them (#QuarkusTest) I am getting a bit nondescriptive error:
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [com.daimler.pia.input.globus.resource.rest.impl.GreetingResourceTest]: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.deployment.steps.ConfigBuildSteps#generateConfigSources threw an exception: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
at io.quarkus.gizmo.GizmoClassVisitor.<init>(GizmoClassVisitor.java:22)
at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:150)
at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:203)
at io.quarkus.deployment.steps.ConfigBuildSteps.generateConfigSources(ConfigBuildSteps.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:915)
at io.quarkus.builder.BuildContext.run(BuildContext.java:279)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[...]
[error]: Build step io.quarkus.jaeger.deployment.JaegerProcessor#setupTracer threw an exception: java.lang.IllegalArgumentException
[...]
[error]: Build step io.quarkus.deployment.logging.LoggingResourceProcessor#setupLoggingRuntimeInit threw an exception: java.lang.IllegalArgumentException
[...]
basicly after each [error] stack trace is the same.
I found some cases on web describing problems with IllegalArgumentException and Quarkus, but usually there was some additional information.
I tried to move example from https://github.com/quarkusio/quarkus-quickstarts/tree/master/getting-started-testing to my project, result was the same. Unfortunetly for time being I do not have time to deal with it. But eventually I will have to go back o that problem. Therefore I have decided to post here my problem becasue I propabbly am missing some small thing (or not) and maybe someone already solve that problem.

Unable to start elasticsearch 2.2.0

I have installed elasticsearch 2.2.0 and it worked fine for a week, but now it didn't start. I have set both JAVA_HOME and JRE_HOME. I use java version 1.8 (i.e., jdk1.8.0_201 and jre1.8.0_202). When I try to start the elasticsearch.bat it terminates with a error message of:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/cli/CommandLineParser
Likely root cause: java.lang.ClassNotFoundException:
org.apache.commons.cli.CommandLineParser
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:241)
at
org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
But no logs has been generated.

Spring can't connect to database when started by Monit

I have a Jetty 6 server running a grails 1.1 (which in turn uses hibernate) application. Since sometimes it goes down, I'd like it to automatically restart if something happens. So, I heard about Monit and decided to give it a try. I've created the following configuration:
check process jetty with pidfile /var/run/jetty.pid
group nfetron
start program = "/data/ebs/NFeTron/bin/jetty.sh start"
stop program = "/data/ebs/NFeTron/bin/jetty.sh stop"
if failed host "localhost" port 8090 protocol HTTP with timeout 10 seconds then restart
if mem usage > 95% for 11 cycles then restart
Well, the problem is that when the Monit starts the Jetty, it doesn't run normally. It fails to connect to the database, as seen in the following log:
2017-02-13 21:35:34.356::INFO: jetty-6.1.14
2017-02-13 21:35:34.404::INFO: Deploy /data/ebs/NFeTron/contexts/javadoc.xml -> org.mortbay.jetty.handler.ContextHandler#153f5a29{/javadoc,file:/data/ebs/NFeTron/java$
2017-02-13 21:35:34.536::INFO: No Transaction manager found - if your webapp requires one, please configure one.
2017-02-13 21:35:34.875::INFO: No Transaction manager found - if your webapp requires one, please configure one.
2017-02-13 21:35:35.404::INFO: No Transaction manager found - if your webapp requires one, please configure one.
2017-02-13 21:35:37.337:/NFeTron:INFO: Initializing Spring root WebApplicationContext
loading security config ...
2017-02-13 21:35:54.383::WARN: Failed startup of context org.mortbay.jetty.webapp.WebAppContext#770c2e6b{/NFeTron,file:/data/ebs/NFeTron/webapps/NFeTron/}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springfr$
at java.security.AccessController.doPrivileged(Native Method)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactor$
at java.security.AccessController.doPrivileged(Native Method)
... 1 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception $
at java.security.AccessController.doPrivileged(Native Method)
... 2 more
Caused by: java.lang.NullPointerException
... 3 more
2017-02-13 21:35:54.384::WARN: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bea$
java.lang.NullPointerException
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
2017-02-13 21:35:54.390::INFO: Opened /data/ebs/NFeTron/logs/2017_02_13.request.log
2017-02-13 21:35:54.456::INFO: Started SelectChannelConnector#0.0.0.0:8090
I searched a lot and couldn't find anyone facing the same problem. When I start the application using SSH (with root user), it works normally. But when Monit starts it (supposedly with root user), it doesn't. Does anyone have any clue about this problem?

Resources