2008/5/7 Laurent Perez <[EMAIL PROTECTED]>:
> Hi
>
> I'm currently trying to run a jmeter 2.3.1 test under maven 2.0.8, using the
> maven-jmeter-plugin available at
> http://wiki.apache.org/jakarta-jmeter/JMeterMavenPlugin : I had to repackage
> a pom.xml for jmeter 2.3.1, because the various blogs explaining how to get
> the jmeter/maven combo running were all using jmeter 2.2, and it didn't work
> anymore for 2.3.1 (and when I have a successfull usage scenario, I will blog
> about it ;)).
>
> My tests are running, but the problem is that they do not exit, the mvn
> console just hangs : looking at the jmeter source code, I noticed that in
> StandardJMeterEngine, there is no call to exit(); when the test runs locally
> (ie when host == null) : there is a simple call to the void testEnded(),
> which prints "... end of run", so how is jmeter supposed to exit ?
>
> I've tried to place a call to exit();, or System.exit(0);, but then I
> received an exception ,"Uncaught Exception
> org.apache.jmeter.JMeterMojo$ExitException: 0" : this class is the
> maven-jmeter-plugin one, it has a specific code snippet [1] to handle calls
> to System.exit(0), but the exception handler does not seem to fire : did
> the exit behaviour change between jmeter2.3.1 and 2.2 ? (given that the
> plugin seems to exit under 2.2).
>
> Thanks if anyone can enlighten me ;)
>
Seems like there is a bug in the way that the Maven plugin calls
JMeter, because it exits fine if you run it with the Ant JMeter task
or indeed using Ant directly, as is done in the unit tests - see
build.xml, batchtest target, <java> call.
> [1] :
> // This mess is necessary because JMeter likes to use
> System.exit.
> // We need to trap the exit call.
> SecurityManager oldManager=System.getSecurityManager();
>
> System.setSecurityManager(new SecurityManager() {
> @Override public void checkExit(int status) { throw new
> ExitException(status);}
> @Override public void checkPermission(Permission perm, Object
> context) {}
> @Override public void checkPermission(Permission perm) {}
> });
> UncaughtExceptionHandler oldHandler =
> Thread.getDefaultUncaughtExceptionHandler();
> Thread.setDefaultUncaughtExceptionHandler(new
> UncaughtExceptionHandler() {
> public void uncaughtException(Thread t, Throwable e) {
> if (e instanceof ExitException && ((ExitException)
> e).getCode() == 0) {
> System.out.println("here !");
> return; //Ignore
> }
> getLog().error("Error in thread " + t.getName());
> }
> });
>
>
>
> --
> <a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com -
> Mobile world, technology and more</a>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]