pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Struts2 plugin should not use System.exit() #113

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If guice fails to create an object (possibly due to missing dependencies in
the classpath during runtime), it will call System.exit(1). I feel this is
a really bad thing for a library to do, as you risk taking down common test
environments if you do an error on deployment.

Example:
You have a test tomcat server that hosts 2 webapps, one of them is beeing
tested by 10 other developers, and the other is a webapp using Guice. You
create the war and deploy it. But the war is missing a jar in the lib
folder that you have in your development environment. When the app starts,
System.exit(1) gets called by Guice, and the entire Tomcat server is shut down.

Original issue reported on code.google.com by mei...@gmail.com on 7 Jun 2007 at 5:12

GoogleCodeExporter commented 9 years ago
This refers to the Struts 2 plugin. In the mean time, the plugin consists of one
class, so it's easy enough to patch your own version to do what you want. This 
plugin
(and probably Struts itself) needs some work.

Original comment by crazybob...@gmail.com on 7 Jun 2007 at 5:28

GoogleCodeExporter commented 9 years ago

Original comment by kevin...@gmail.com on 7 Jun 2007 at 5:31

GoogleCodeExporter commented 9 years ago
Just saw this and wanted to comment. I prefer it to exit since Guice is acting 
as the
object provider for Struts. In all the cases I've seen, some configuration is 
missing
and therefore the application will not work unless that configuration is fixed.
Therefore, it seems correct that the application should be terminated since 
Guice
can't create an object that the application requires.

Original comment by bpontare...@gmail.com on 16 Jul 2007 at 4:52

GoogleCodeExporter commented 9 years ago
That's crazy. It should throw an exception, not shut down the JVM.

Original comment by robbie.v...@gmail.com on 16 Jul 2007 at 8:46

GoogleCodeExporter commented 9 years ago
Agree, this really bottleneck is this plugin.

Original comment by rpo...@gmail.com on 25 Aug 2007 at 6:27

GoogleCodeExporter commented 9 years ago
I suppose we could rethrow the CreationException every time Struts tries to 
create an
action, etc.

Original comment by crazybob...@gmail.com on 9 Sep 2007 at 9:12

GoogleCodeExporter commented 9 years ago
Just to chip in.  I definitely don't think this should be bringing down the
container.  Just an exception and the trace to stderr would suffice.  And then 
yes -
fair enough; an exception every time an instance is requested.

Original comment by mpetz...@gmail.com on 12 Feb 2008 at 7:35

GoogleCodeExporter commented 9 years ago
It is an extremely bad idea to shutdown the whole JVM due to one rogue app.

Original comment by stan.clo...@gmail.com on 13 Feb 2008 at 8:28

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 27 Apr 2009 at 6:15

GoogleCodeExporter commented 9 years ago
Hi we are using Guice with the struts 2 portlet plugin and having one portlet 
bring down a whole portal is really annoying. Defeats the whole purpose of 
enterprise portals. Please fix this.

Original comment by xata...@gmail.com on 8 Jul 2010 at 5:43

GoogleCodeExporter commented 9 years ago
FYI, the new version, Struts2Factory has a better behavior:
http://code.google.com/p/google-guice/source/browse/trunk/extensions/struts2/src
/com/google/inject/struts2/Struts2Factory.java

You can probably close this issue as being fixed in the next release.

Original comment by benjamin...@gmail.com on 4 Dec 2010 at 6:08

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 4 Dec 2010 at 3:37