How to make DispatcherServlet initialization errors bubble up from embedded Jetty?

I have an application which contains an Embedded Jetty instantiated by a main application context. In Jetty there's an additional Spring web application context initialized and a service is exported using HTTP Invoker. Currently when the embedded context fails to initialize (by DispatcherSerlvet) the web application context is simply unavailable, but Jetty continues to run on the specified port. This makes the application inconsistent. I like to somehow tear down the main context (and the application) if the embedded Spring context fails to start. What is the correct way to do this? Is there any listener for DispatcherServlet to get notified about initialization problems?

Answers


I've managed to solve this on my own. Jetty's ServletHolder and WebAppContext classes now have a getUnavailableException() function which returns the initialization error or null if startup was successful. See the JETTY-319 feature request ticket. I've added an ID to the ServletHolder bean which manages Spring's DispatcherServlet and after the refresh of the outer Spring context i've added a simple check against this bean. On an error i can tear down the application as i like to.


Need Your Help

Does boto.dynamodb2 support storing a dict of dicts?

python amazon-web-services amazon-dynamodb

Solution: Updating to the brand-new boto 2.35.2 fixed the problem.

How to Show the hidden Item in ng-repeat by external directive in angular JS?

javascript jquery angularjs angularjs-directive ng-hide

I am displaying a loop of items from a list in controller using ng-repeat directive. They are just the regular todo items with a minimize button. So, what I am doing to minimize the items is by set...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.