surefire:test finds a resource inside a jar, but can't load a class inside it?
------------------------------------------------------------------------------
Key: MNG-1800
URL: http://jira.codehaus.org/browse/MNG-1800
Project: Maven 2
Type: Bug
Components: maven-surefire-plugin
Versions: 2.0
Reporter: Matthew Beermann
Priority: Critical
Fix For: 2.0.1
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]