This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268227 - Awaitility ClassNotFoundExeption
Summary: Awaitility ClassNotFoundExeption
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: NB JUnit (show other bugs)
Version: 8.1
Hardware: PC Windows 8.1
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-27 09:52 UTC by rsobies
Modified: 2016-09-28 08:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test depency (8.59 KB, image/png)
2016-09-27 09:52 UTC, rsobies
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rsobies 2016-09-27 09:52:54 UTC
Created attachment 162234 [details]
Test depency

i am trying to use Awaitility library in test unit of my netbens rcp application (tests are in main project, maven) 
When running public static Test.suite(), classes from awaitility lib are loaded by the systemClassLoader. 
but if the test method is invoked, the default class loader is changed( to org.netbeans.ModuleManager.SystemClassLoader i guess) and Awaitility classes are no longer seen. 

[code]
import java.util.concurrent.TimeUnit; 
import junit.framework.Test; 
import org.awaitility.Awaitility; 
import org.netbeans.junit.NbModuleSuite; 
import org.netbeans.junit.NbTestCase; 

public class ApplicationTest extends NbTestCase { 

    public static Test suite() { 
        
        Awaitility.setDefaultTimeout(0, TimeUnit.DAYS); //this line makes no exceptions
        
        return NbModuleSuite.createConfiguration(ApplicationTest.class). 
                gui(false). 
                //failOnMessage(Level.WARNING). // works at least in RELEASE71 
                //failOnException(Level.INFO). 
                enableClasspathModules(false). 
                clusters(".*"). 
                suite(); // RELEASE71+, else use NbModuleSuite.create(NbModuleSuite.createConfiguration(...)) 
        
        
    } 

    public ApplicationTest(String n) { 
        super(n); 
    } 

    public void testApplication() { 
        Awaitility.setDefaultTimeout(0, TimeUnit.DAYS); //this line makes NoclassFoundException
        
    } 

}
[/code]
Comment 1 rsobies 2016-09-27 09:56:08 UTC
..and the output

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.332 sec <<< FAILURE! - in com.radmor.wsd.ApplicationTest 
testApplication(com.radmor.wsd.ApplicationTest)  Time elapsed: 0.01 sec  <<< ERROR! 
java.lang.NoClassDefFoundError: org/awaitility/Awaitility 
   at com.radmor.wsd.ApplicationTest.testApplication(ApplicationTest.java:50) 
Caused by: java.lang.ClassNotFoundException: org.awaitility.Awaitility starting from SystemClassLoader[78 modules] with possible defining loaders null and declared parents [org.netbeans.MainImpl$BootClassLoader@2ef5e5e3, ModuleCL@71e1ee30[org.netbeans.api.annotations.common], ModuleCL@31739508[org.openide.awt], ModuleCL@2a7e3226[org.netbeans.api.progress], ModuleCL@7bfdbd20[org.netbeans.api.progress.nb], ModuleCL@41b0f4b[org.openide.dialogs], ModuleCL@19503cca[org.openide.nodes], ModuleCL@65ae547d[org.openide.windows], ModuleCL@666c96e7[org.netbeans.modules.editor.mimelookup], ModuleCL@53edf7db[org.openide.text], ...59 more] 
   at com.radmor.wsd.ApplicationTest.testApplication(ApplicationTest.java:50) 
Caused by: java.lang.ClassNotFoundException: org.awaitility.Awaitility 
   at com.radmor.wsd.ApplicationTest.testApplication(ApplicationTest.java:50)