You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Brett Porter (JIRA)" <ji...@codehaus.org> on 2007/01/21 23:29:19 UTC

[jira] Moved: (SUREFIRE-194) surefire:test finds a resource inside a jar, but can't load a class inside it?

     [ http://jira.codehaus.org/browse/SUREFIRE-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter moved MSUREFIRE-3 to SUREFIRE-194:
-----------------------------------------------

    Complexity:   (was: Intermediate)
           Key: SUREFIRE-194  (was: MSUREFIRE-3)
       Project: Maven Surefire  (was: Maven 2.x Surefire Plugin)

> surefire:test finds a resource inside a jar, but can't load a class inside it?
> ------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-194
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-194
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Matthew Beermann
>            Priority: Critical
>
> We're using Java's SPI mechanism to load implementations at runtime. To be exact, the iface jar looks for a particular file (using ClassLoader.getResource) when the application starts, and reads inside of it to find out what the real implementation is. Then, it uses reflection (ClassLoader.loadClass) to actually load the class.
> This mechanism works like a dream in Eclipse, JUnit, etc, but fails mysteriously in Maven 2. I say mysteriously, because it locates the file in the impl jar, but then can't manage to load the class inside that jar! Snippets from my build log... sorry for the redacting, but it's not open-source code being built...
> [DEBUG] Test Classpath :
> ...
> [DEBUG] C:\my-implementation.jar
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> ServiceProviderLookupFacility: The class [BasicLoggerManager] configured in the service provider configuration file [jar:file:C:/my-implementation.jar!/META-INF/services/LoggerManager] could not be found and will be skipped.
> ServiceProviderLookupFacility:  java.lang.ClassNotFoundException: BasicLoggerManager
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> 	at org.codehaus.surefire.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:69)
>                      <where my code called ClassLoader.loadClass>
> Any insights into what's going on here? This seems tremendously broken...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira