wisdom-framework / wisdom

A modular and dynamic web framework
http://wisdom-framework.org
Apache License 2.0
88 stars 42 forks source link

Web server down when a REST ressource is badly declared #349

Closed evrignaud closed 10 years ago

evrignaud commented 10 years ago

If we have a REST method that does not return a Result, the complete web server is down. We could expect that on any kind of error, the badly declared REST method will not be published, but the server will still continue to work.

cescoffier commented 10 years ago

What do you mean by stop ? The watch mode exited ? The server is completely done ? By default, if a route of a controller is broken, the whole controller is disabled. Thus, you have more change to see that something is wrong (even if you are not testing the broken route)

evrignaud commented 10 years ago

I mean that in a projet if you have one REST ressource that is badly declared with another type than Result, then Wisdom removes all the routes and shutdown the web server. For me it's normal that the badly declared ressource is not published. Or the complete controller to be down. But the other controllers should be ok and the server up. I got the following log messages with this sample https://www.dropbox.com/s/1za1qzegbwc8fcy/sample.tar.gz?dl=0 Thats sure that the HelloController1 is wrong, but the WelcomeController should be published.

[INFO]   o.w.c.j.JacksonSingleton {[iPOJO] pool-1-thread-1} - Adding JSON module org.wisdom.monitor.service.MonitorExtension 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.MonitorCenter@5005ce1b 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.dashboard.DashboardExtension@ea2b388 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.ipojo.IPOJOController@20880a03 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.logger.LoggerExtension@3773d67f 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.osgi.BundleMonitorExtension@57a131a4 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.osgi.ServiceMonitorExtension@6ca42f39 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.terminal.WisitShellController@61dacd 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.wisdom.ControllerExtension@705181d8 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from org.wisdom.monitor.extensions.wisdom.RouterExtension@32e5e4bb 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from controllers.Documentation@a799d2e 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Adding routes from sample.HelloController1@75e1ed53 
13/09/14 13:18:30 (G) LoggerService.log : [ERROR]  : The method bindController in the implementation class org.wisdom.router.RequestRouter throws an exception : Cannot find the controller method `public java.lang.String sample.HelloController1.toto()` in `class sample.HelloController1`, or the method does not return a org.wisdom.api.http.Result object
java.lang.IllegalArgumentException: Cannot find the controller method `public java.lang.String sample.HelloController1.toto()` in `class sample.HelloController1`, or the method does not return a org.wisdom.api.http.Result object
    at org.wisdom.api.router.RouteBuilder.to(RouteBuilder.java:114)
    at org.wisdom.api.router.RouteUtils.collectRouteFromControllerAnnotations(RouteUtils.java:124)
    at org.wisdom.router.RequestRouter.__M_bindController(RequestRouter.java:120)
    at org.wisdom.router.RequestRouter.bindController(RequestRouter.java)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.felix.ipojo.util.Callback.call(Callback.java:237)
    at org.apache.felix.ipojo.handlers.dependency.DependencyCallback.call(DependencyCallback.java:232)
    at org.apache.felix.ipojo.handlers.dependency.Dependency.invokeCallback(Dependency.java:338)
    at org.apache.felix.ipojo.handlers.dependency.Dependency.callBindMethod(Dependency.java:383)
    at org.apache.felix.ipojo.handlers.dependency.Dependency.onServiceArrival(Dependency.java:544)
    at org.apache.felix.ipojo.util.DependencyModel.onChange(DependencyModel.java:1106)
    at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.fireUpdate(ServiceReferenceManager.java:561)
    at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.onNewMatchingService(ServiceReferenceManager.java:525)
    at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.addedService(ServiceReferenceManager.java:504)
    at org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:711)
    at org.apache.felix.ipojo.util.Tracker$Tracked.track(Tracker.java:672)
    at org.apache.felix.ipojo.util.Tracker$Tracked.serviceChanged(Tracker.java:633)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:943)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:794)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:544)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4445)
    at org.apache.felix.framework.Felix.registerService(Felix.java:3431)
    at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
    at org.apache.felix.ipojo.IPojoContext.registerService(IPojoContext.java:395)
    at org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registerService(ProvidedService.java:351)
    at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__M_stateChanged(ProvidedServiceHandler.java:484)
    at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.stateChanged(ProvidedServiceHandler.java)
    at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560)
    at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:440)
    at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:179)
    at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:319)
    at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:240)
    at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:312)
    at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:306)
    at org.apache.felix.ipojo.extender.internal.queue.JobInfoCallable.call(JobInfoCallable.java:114)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoSuchMethodException
    at org.wisdom.api.router.RouteBuilder.to(RouteBuilder.java:110)
    ... 41 more
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.wisdom.ControllerExtension@705181d8 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.wisdom.RouterExtension@32e5e4bb 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://53.0:0/templates/assets/list.thl.html from org.wisdom-framework.resource-controller 
13/09/14 13:18:30 (A) LoggerService.log : [WARNING]  : [org.wisdom.template.thymeleaf.tracker.TemplateTracker-0] The dependency is not optional, however no service object can be injected in engine -> org.wisdom.template.thymeleaf.ThymeleafTemplateCollector
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://59.0:0/templates/welcome.thl.html from org.sample 
13/09/14 13:18:30 (A) LoggerService.log : [WARNING]  : [org.wisdom.template.thymeleaf.tracker.TemplateTracker-0] The dependency is not optional, however no service object can be injected in engine -> org.wisdom.template.thymeleaf.ThymeleafTemplateCollector
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/bundles.thl.html from org.wisdom.framework.wisdom.monitor 
13/09/14 13:18:30 (A) LoggerService.log : [WARNING]  : [org.wisdom.template.thymeleaf.tracker.TemplateTracker-0] The dependency is not optional, however no service object can be injected in engine -> org.wisdom.template.thymeleaf.ThymeleafTemplateCollector
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/controllers.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/dashboard.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/ipojo.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/layout.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/loggers.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/login.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/routes.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/services.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/terminal.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.t.t.t.TemplateTracker {[iPOJO] pool-1-thread-1} - Thymeleaf template deleted for bundle://57.0:0/templates/monitor/tiles.thl.html from org.wisdom.framework.wisdom.monitor 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.MonitorCenter@5005ce1b 
[INFO]   o.w.c.j.JacksonSingleton {[iPOJO] pool-1-thread-1} - Removing Jackson module org.wisdom.monitor.service.MonitorExtension 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.terminal.WisitShellController@61dacd 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.resources.AssetsSingleton@4bc33a68 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.osgi.BundleMonitorExtension@57a131a4 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.ipojo.IPOJOController@20880a03 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.dashboard.DashboardExtension@ea2b388 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.osgi.ServiceMonitorExtension@6ca42f39 
[INFO]   o.w.r.RequestRouter {[iPOJO] pool-1-thread-1} - Removing routes from org.wisdom.monitor.extensions.logger.LoggerExtension@3773d67f 
[INFO]   wisdom-netty-engine {[iPOJO] pool-1-thread-1} - Wisdom server has been stopped gracefully 
jbrey commented 10 years ago

one more precision: also fixing the problem when you are running the watch mode does not make the web server up. you need to stop wisdom and rerun the mvn wisdom:run.

cescoffier commented 10 years ago

Thanks for the sample project. It definitely looks like a bug. Will have a look tomorrow (spent way to much time to get jacoco on integration test working).

cescoffier commented 10 years ago

Just found the root cause: such errors kills the router:

[ STOPPED] router

as a consequence, the engine stops.