Found that Camel EventNotifierSupport is not triggered with camel-spring-boot.
When working without camel-spring-boot, I am able to see this log. Should I use another lifecycle supporting class instead? Thanks in advance
2016-02-12 11:05:59,191 | main | INFO | com.ch.integration.camel.notifier.CamelEventNotifier | Started CamelContext: camel
2016-02-12 11:06:12,709 | Thread-0 | INFO | com.ch.integration.camel.notifier.CamelEventNotifier | Stopped CamelContext: camel
Looks like your application is stopping soon after it starts, which means the app is not a webapp, since there is no embedded servlet container it is stopping. There are two ways to keep it running
Using Main class from Camel as mentioned in http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
Adding spring-boot-starter-web dependency Why does my Spring Boot App always shutdown immediately after starting?
Hope it helps, if the above assumption is not correct please provide some more console output, of DEBUG level.
Related
I am creating a demo application for Groovy using Spring boot with Kafka and elastic.
I used #EmbeddedKafka annotation in my Spock tests and they are working really nice locally; both on Windows and Ubuntu. They work from within Intellij by just running or debuggin, no issue. It's the same when trying in my shell "./gradlew test". Everything is good.
As soon as I pushed it to github.com, my github action fails. But it's calling the same command.
the action definition: https://github.com/besessener/GroovySpringBootKafkaElasticsearchDemo/blob/main/.github/workflows/test.yml
remote failing test case:
https://github.com/besessener/GroovySpringBootKafkaElasticsearchDemo/blob/main/src/test/groovy/me/spring/GroovyDemo/stream/KafkaSendAndReceiveTest.groovy
action: https://github.com/besessener/GroovySpringBootKafkaElasticsearchDemo/runs/3019862203?check_suite_focus=true
The only thing that looks like an error to me from the actions output, is this:
2021-07-08 14:05:35.896 WARN 2693 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-UserGroup-1, groupId=UserGroup] Error while fetching metadata with correlation id 4 : {topic-user=LEADER_NOT_AVAILABLE}
I read many things about not using static ports for the kafka tests. but this is my only kafka test, so I don't really understand how there should be a conflict. Furthermore LEADER_NOT_AVAILABLE could be a problem with a non-existing topic or maybe the consumer is simply not able to properly conenct to the broker. But I don't see any of this.
I still have the feeling it is more related to "localhost:9092" as brokerProperties. Is there an issue in regards to that when using Github actions? Or anything else I am missing?
I am learning spring MVC, Can someone tell me when WebApplicationCotext gets initialized? and who is responsible to initialize WebApplicationContext?
i think it is initialized in the first time when the app runs, here is my log when spring webapp starts, the server container is reponsible to it?
I would like to stop Tomcat when a war deployment fails. Is there some hook or listener which could be used for that?
I know, normally one would not make the container stop when a deployment fails. In my case I would like to implement a Fail-fast error model with Tomcat since there is currently no chance to replace the WAR with a fat jar with an embedded Servlet engine (e.g., Spring-Boot).
In the mean time I have implemented a Tomcat LifecycleListener which shuts down TC when a deployment fails: https://github.com/ascheman/tomcat-lifecyclelistener
Thanks to Thomas Meyer who gave some hints on Twitter: https://twitter.com/thomasmey/status/752971635825729537.
Spring boot provides shutdown hook. SOF has similar query as below
Spring Boot shutdown hook
This can give and idea to implement your app Fail Fast behavior with hook.
the glassfish application server provides a nice monitoring REST interface.
To use it u can enable several monitorable items in the admin console, for example the EJB container. The documentation says, you can retreive EJB-statistics for every deployed application.
If you request a URL like localhost:4848/monitoring/domain1/server/applications/APPNAME/EJBNAME you will get statistics for a given EJB of the application.
Further, there is a possibility to look more deeply into each bean-method of the ejb, for example the executiontime, about which the documentation says:
"Time, in milliseconds, spent executing the method for the last successful/unsuccessful attempt to run the operation. This is collected for stateless and stateful session beans and entity beans if monitoring is enabled on the EJB container."
The problem now is, monitoring is enabled on the EJB-container (Level set to HIGH), but nothing is sampled in any bean-method in any EJB in any deployed application.
Is there something special to do in the bean and/or the glassfish ?
Thanks in advance for help,
Chris
EDIT:
Ok, I noticed something more about that behaviour:
In the server log you get a log message for each deployed EJB like that:
INFO: EJB5181:Portable JNDI names for EJB DataFetcher // ...
If I set the ejb-container monitoring level to HIGH (which is what I want to do), I get the following warning for each deployed EJB, regardless which app I deploy:
WARNING: MNTG0201:Flashlight listener registration failed for listener class : com.sun.ejb.monitoring.stats.StatelessSessionBeanStatsProvider , will retry later
I googled the warning but none of the resulst really help me enabling EJB monitoring...
This seems to be a Bug in Glassfish.
EJB Monitoring is currently not working in 3.1.2.
JIRA issue is already raised: http://java.net/jira/browse/GLASSFISH-19677
There is nothing "special" to do.
http://docs.oracle.com/cd/E18930_01/html/821-2431/abeea.html
For me it seems as if you probably enabled the monitoring option on the wrong configuration. Please double check.
To get rid of this message you can disable the monitoring on ejb container option below in the image
From Monitor Data--->Configure monitoring--->make ejb container log off
When i am running my application it give me this exception:-
Exception sending context initialized event to listener instance of class
org.springframework.web.util.Log4jConfigListener
java.lang.ExceptionInInitializerError
But this problem is not permanent. If i remove the log4j entries from web.xml and restart p.c and then again add log4j entries and start the server, then the application works fine.
I noticed that when the application is deployed and when i undeploy and again deploy the same application, this problem emerge.
Please help me ........ i am facing this problem from 3 months...
I just investigated it a little and have found the similar issue:
It causes when multiple jar file for log4j is available to application.
From web/application server and from build path(Included from other
path rather than web/application server)
You can see the entire thread here:
http://www.coderanch.com/t/551933/Spring/Exception-sending-context-initialized-event
looks like this is your problem.