I upgraded Failsafe to 2.7.1, and things definitely progressed, but two interesting things are happening:
1) Every test runs even though I configure for only one test to run as you will see below. 2) All my tests that extend AbstractTestNGSpringContextTests are having problems with loading the application context. Sounds like some classloader stuff going on with Maven interacting with Spring and RESTEasy. Again, everything works perfectly with Maven 2.2.0. Here is the configuration again: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.7.1</version> <configuration> <useSystemClassLoader>true</useSystemClassLoader> <useManifestOnlyJar>false</useManifestOnlyJar> <includes> <include>**/CategoriesServiceDelegateIT.java</include> </includes> </configuration> <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> Thanks. -----Original Message----- From: anders.g.ham...@gmail.com [mailto:anders.g.ham...@gmail.com] On Behalf Of Anders Hammar Sent: Friday, January 14, 2011 4:30 PM To: Maven Users List Subject: Re: Classloader Problem with Maven 3.0.2 You're using an old and deprecated version of the failsafe plugin. I don't think it works with Maven 3. failsafe-m-p is now found at Apache Maven (not Codehaus Mojo): http://maven.apache.org/plugins/maven-failsafe-plugin/ Upgrade and retry! /Anders On Fri, Jan 14, 2011 at 20:27, Neil Chaudhuri <nchaudh...@potomacfusion.com>wrote: > I have upgraded from Maven 2.20 to 3.02, and I found many of my integration > tests that used to pass are now failing because of a ClassCastException, > which is an odd exception to find when no code has changed. I traced the > issue to a classloader problem with Maven 3 that arises in another Java > library (RESTEasy if you were wondering). > > Here is their code: > > try > { > Object delegate = > FactoryFinder.find(JAXRS_RUNTIME_DELEGATE_PROPERTY, > JAXRS_DEFAULT_RUNTIME_DELEGATE); > if (!(delegate instanceof RuntimeDelegate)) > { > Class pClass = RuntimeDelegate.class; > String classnameAsResource = pClass.getName().replace('.', '/') > + ".class"; > ClassLoader loader = pClass.getClassLoader(); > if (loader == null) > { > loader = ClassLoader.getSystemClassLoader(); > } > URL targetTypeURL = loader.getResource(classnameAsResource); > throw new LinkageError("ClassCastException: attempting to cast" + > > delegate.getClass().getClassLoader().getResource(classnameAsResource) + > "to" + targetTypeURL.toString()); > } > return (RuntimeDelegate) delegate; > } > catch (Exception ex) > { > throw new RuntimeException(ex); > } > > And here is my pom configuration: > > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>failsafe-maven-plugin</artifactId> > <version>2.4.3-alpha-1</version> > <configuration> > <useSystemClassLoader>false</useSystemClassLoader> > <useManifestOnlyJar>false</useManifestOnlyJar> > <forkMode>once</forkMode> > <includes> > > <include>**/CategoriesServiceDelegateIT.java</include> > </includes> > </configuration> > <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> > > When I set useSystemClassLoader to true, the ClassCastException goes away, > but then nothing happens except for a hard exit. I see nothing in the logs > or in failsafe-reports to tell me what happened. > > Any insight into why things work in Maven 2.20 but not in 3.02 is > appreciated. > > Thanks. > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org