-
1. Re: java.lang.NoClassDefFoundError - Problem with inheritanc
kragoth Nov 30, 2008 8:10 PM (in response to vitorisaia)I have a test heirachy and it works just fine. So maybe you have bumped into some classloading weirdness.
This is my setup:public class AbstractGekkoWebTest extends ServletTestCase { ... @Override protected final void setUp() throws Exception { super.setUp(); ...//my own code to do crazy stuff with spring injection :P this.afterSetUp(); } //SETUP THE SESSION HERE AND LOGIN TO THE SYSTEM public void afterSetUp() throws Exception { log.debug("GekkoWebTest.afterSetUp(): Request page: " + HomePageDriver.PAGE); // Send an HTTP request for the initial page // There is currently a bug with running as IE 6 so, leave it on Firefox for now //WebClientSpec wcSpec = new WebClientSpec(HomePageDriver.PAGE, BrowserVersion.FIREFOX_2); WebClientSpec wcSpec = new WebClientSpec(HomePageDriver.PAGE, BrowserVersion.INTERNET_EXPLORER_6); testContext.setSession(new JSFSession(wcSpec)); //Logging in should probably be done differently but...this will do for now log.debug("GekkoWebTest.afterSetUp(): Logging in"); HomePageDriver homePageDriver = getPageDriver(HomePageDriver.class); homePageDriver.setUsername("xxxxxxxx"); assertTrue(homePageDriver.isDisplayed()); homePageDriver.clickSubmit(); log.debug("After login the page is:" + testContext.getServer().getCurrentViewID()); } ... }
And now each of my tests are declared like this:public class TenureMaintenanceTest extends AbstractGekkoWebTest {
-
2. Re: java.lang.NoClassDefFoundError - Problem with inheritanc
ssilvert Nov 30, 2008 9:13 PM (in response to vitorisaia)The only way I can think of that HttpSessionBindingListener would not be found is if you are outside the container. So this could happen when ant or maven calls JUnit to create an instance of your test class, but before the execution call is proxied to the ServletRedirector inside the container.
So I suspect that maybe you are calling initializeSession() from a constructor instead of from the setUp() method.
You should be fine if you do it like Kragoth showed. If you are still having trouble please try to post more of the source code and more of the stack trace.
Stan -
3. Re: java.lang.NoClassDefFoundError - Problem with inheritanc
vitorisaia Dec 1, 2008 6:28 AM (in response to vitorisaia)Thank you, Kragoth and Stan.
Stan, you are absolutely.
I moved the initializeSession() method to the setUp method of BaseWebTest and now it works.
Thank you very much.
Regards,
Vitor Isaia. -
4. Re: java.lang.NoClassDefFoundError - Problem with inheritanc
vitorisaia Dec 1, 2008 6:31 AM (in response to vitorisaia)"Vitor Isaia" wrote:
Stan, you are absolutely.
I meant: Stan, you are absolutely right. -
5. Re: java.lang.NoClassDefFoundError - Problem with inheritanc
kragoth Dec 1, 2008 6:09 PM (in response to vitorisaia)Nice pickup Stan :) That didn't even occur to me! I need to get a little more familiar with exactly how JSFUnit works at the core level. :S