[ http://jira.codehaus.org/browse/MSUREFIRE-123?page=comments#action_67639 ]
Konstantin Pribluda commented on MSUREFIRE-123: ----------------------------------------------- I found cause of this problem - it's a mix between java.net.URL and classloading in surefire. My findings: - URL actually receives system property - URL is loaded by root classloader ( because it is used by SurefireBooter ) - internally java.net.URL does Class.forName() -> this fails, because your classes are in IsolatedClassloader -> clasloaded which loaded URL does not know about it - as a fallback URL does : ClassLoader.getSystemClassLoader().loadClass() -> which also fails for the same reason. So, there is no chance to get it to work without patching surefirebooter. Quick workaroung ( ugly hack, but it works ) : ..........................%<--------------- URL.setURLStreamHandlerFactory( new URLStreamHandlerFactory() { public URLStreamHandler createURLStreamHandler(String protocol) { if("memory".equals(protocol)){ return new Handler(); } return null; }}); ..........................%<--------------- before you try to create URL, in every testcase... ( since it may be forked... ) > unable to establish my own http protocol handler for unit tests > --------------------------------------------------------------- > > Key: MSUREFIRE-123 > URL: http://jira.codehaus.org/browse/MSUREFIRE-123 > Project: Maven 2.x Surefire Plugin > Type: Bug > Versions: 2.2 > Environment: jse 5.0 (osx) > Reporter: Andy Fyfe > Attachments: protocol.zip > > > In order to establish my own http protocol handler, I set the system property > java.protocol.handler.pkgs and ensure that the tests require a fork. The > test runs fine under maven 1.0.2, but fails under maven 2.0.4. I have tried > both surefire 2.1.3 and 2.2, and both with the childDelegation option. > The test sees the system property properly set, but the test's protocol > handler is not actually used. > The attached zip file demonstrates this problem (run "maven test" and "mvn > test"). -- 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