webelement standalone org openqa library español descargar dependency dependencias maven selenium integration-testing maven-jetty-plugin

standalone - Maven+Selenium+Jetty-ClassNotFoundException cuando Jetty se está apagando



selenium server standalone (3)

Estoy ejecutando una prueba de integración con Maven, Selenium y Jetty. Las pruebas se ejecutan correctamente, pero cuando el servidor se cierra, el servidor Jetty lanza una java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.dgm$371 . Aquí está el rastro completo de la pila:

------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.main.SeleniumHelloWorldExampleIT Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.479 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- selenium-maven-plugin:2.3:stop-server (stop-selenium) @ MySampleWebApp --- Stopping Selenium server... 00:28:55,976 INFO [org.openqa.jetty.util.Credential] Checking Resource aliases 00:28:55.983 INFO - Command request: shutDownSeleniumServer[, ] on session null 00:28:55.989 INFO - Shutdown command received 00:28:55.992 INFO - Got result: OK on session null 00:28:55.994 INFO - initiating shutdown Stop request sent [INFO] [INFO] --- maven-jetty-plugin:6.1.26:stop (stop-jetty) @ MySampleWebApp --- [INFO] [INFO] --- maven-failsafe-plugin:2.9:verify (verify) @ MySampleWebApp --- [INFO] Stopping server 0 [INFO] Stopped [email protected]:8080 [INFO] Failsafe report directory: D:/projects/mvn-ckbk-samples/ch-2/test-auto/MySampleWebApp/target/failsafe-reports [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:06.833s [INFO] Finished at: Sat Nov 09 00:28:56 VET 2013 [INFO] Final Memory: 15M/38M [INFO] ------------------------------------------------------------------------ [INFO] Shutdown hook executing java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.dgm$371 at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227) at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.createProxy(GeneratedMetaMethod.java:86) at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.proxy(GeneratedMetaMethod.java:79) at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.isValidMethod(GeneratedMetaMethod.java:65) at groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:2808) at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2800) at groovy.lang.MetaClassImpl.getMethodWithCachingInternal(MetaClassImpl.java:1181) at groovy.lang.MetaClassImpl.createPojoCallSite(MetaClassImpl.java:3001) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:114) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:148) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124) at org.codehaus.gmaven.mojo.support.ProcessLauncher$_launch_closure1.doCall(ProcessLauncher.groovy:65) 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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149) at org.codehaus.gmaven.mojo.support.ProcessLauncher$_launch_closure1.doCall(ProcessLauncher.groovy) 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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) at groovy.lang.Closure.call(Closure.java:276) at groovy.lang.Closure.call(Closure.java:271) at groovy.lang.Closure.run(Closure.java:354) at java.lang.Thread.run(Thread.java:724) Exception in thread "Selenium Server Runner" org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.dgm$371 at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:95) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) at groovy.lang.Closure.call(Closure.java:276) at groovy.lang.Closure.call(Closure.java:271) at groovy.lang.Closure.run(Closure.java:354) at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.dgm$371 at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227) at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.createProxy(GeneratedMetaMethod.java:86) at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.proxy(GeneratedMetaMethod.java:79) at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.isValidMethod(GeneratedMetaMethod.java:65) at groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:2808) at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2800) at groovy.lang.MetaClassImpl.getMethodWithCachingInternal(MetaClassImpl.java:1181) at groovy.lang.MetaClassImpl.createPojoCallSite(MetaClassImpl.java:3001) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:114) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:148) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124) at org.codehaus.gmaven.mojo.support.ProcessLauncher$_launch_closure1.doCall(ProcessLauncher.groovy:65) 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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149) at org.codehaus.gmaven.mojo.support.ProcessLauncher$_launch_closure1.doCall(ProcessLauncher.groovy) 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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88) ... 7 more [INFO] Shutdown hook complete Process finished with exit code 0

¿Alguna idea de por qué está sucediendo esto?

El POM que estoy usando:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>MySampleWebApp</groupId> <artifactId>MySampleWebApp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>MySampleWebApp Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <scope>test</scope> <version>2.37.1</version> </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jsp-2.1</artifactId> <version>6.0.0</version> </dependency> </dependencies> <build> <finalName>MySampleWebApp</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <version>2.3</version> <executions> <execution> <id>start-selenium</id> <phase>pre-integration-test</phase> <goals> <goal>start-server</goal> </goals> <configuration> <background>true</background> </configuration> </execution> <execution> <id>stop-selenium</id> <phase>post-integration-test</phase> <goals> <goal>stop-server</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.26</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <stopKey>stop</stopKey> <stopPort>8005</stopPort> </configuration> <executions> <execution> <id>start-jetty</id> <phase>pre-integration-test</phase> <goals> <goal>run</goal> </goals> <configuration> <scanIntervalSeconds>0</scanIntervalSeconds> <daemon>true</daemon> </configuration> </execution> <execution> <id>stop-jetty</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> <!-- Failsafe for integration testing --> <!-- This ensures that post-integration tests are run even if testing fails --> <!-- Integration tests are *IT.java by default --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.9</version> <executions> <execution> <id>integration-test</id> <goals> <goal>integration-test</goal> </goals> </execution> <execution> <id>verify</id> <goals> <goal>verify</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>



Resolví esto, agregando esta dependencia

<dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jsp-2.1</artifactId> <version>6.0.0</version> </dependency>


Intente agregar un stopWait a la configuración del muelle:

<configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <stopKey>stop</stopKey> <stopPort>8005</stopPort> <stopWait>5</stopWait> </configuration>

Esto asegura que el muelle se detenga antes de que se ejecute el siguiente objetivo de maven y, lo que es más importante, antes de que se complete la construcción.

Es en este caso en el que Jetty está intentando apagar cuando la compilación de Maven ha completado que verá este ClassNotFoundError.

Ver también http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#jetty-stop-goal