Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
ClassNotFoundException in spring dm integration test, wierd! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassNotFoundException in spring dm integration test, wierd!

    In my integration test cases, if test methods are in one test class, it works well. But if I seperate them into many test classes, the first test class works well, but the others failed for ClassNotFoundExceptions, and in fact the bundles are really in osgi container.

    codes like this:
    [base abstract class]
    public abstract class AbstractBaseProcessorTest extends AbstractConfigurableBundleCreatorTests {
    @Override
    protected String[] getTestBundlesNames() {
    return new String[] {
    "org.springframework,org.springframework.context,3 .0.0.RC1",
    "org.springframework,org.springframework.context.s upport,3.0.0.RC1",
    "org.springframework,org.springframework.asm,3.0.0 .RC1",
    ......
    }
    }

    [first test class to run, and works well]
    public class ATest extends AbstractBaseProcessorTest {
    public void test1() throws Exception {
    public void test3() throws Exception {
    System.out.println((new Bundle1()).getClass().getName());
    }
    }

    [second test class to run, and failed]
    public class ProcessorChainTest extends AbstractBaseProcessorTest {
    public void test1() throws Exception {
    Bundle[] bs = this.bundleContext.getBundles();
    System.out.println("覧覧覧覧bundle start覧覧覧覧");
    System.out.println(bs.length);
    for(Bundle b: bs){
    System.out.print(" " + b.getSymbolicName());
    System.out.print(";bundle-version=\"");
    System.out.print(b.getVersion());
    System.out.println("\",");

    }
    System.out.println("覧覧覧覧bundle end覧覧覧覧");
    if (StringUtils.isBlank("")){
    System.out.println("Blank");
    } else {
    System.out.println("not Blank");
    }
    System.out.println(DateFormatUtils.format(new Date(), "HH:mm:ssZZ"));

    }
    ......
    }

    [and error log as below]
    java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at com.baidu.fengchaotest.mars.processor.ProcessorCha inTest.test1(ProcessorChainTest.java:64)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
    at org.eclipse.osgi.internal.loader.BundleLoader.find ClassInternal(BundleLoader.java:494)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:410)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:398)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.loadClass(DefaultClassLoader.java:105)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
    ... 45 more

    if I move the failed test method into first test class, or remove the first class, the failed one will pass. I am confused by this, need help!

    PS: I use equinox3.5.1.R35x_v20090827, spring3.0.0.RC1, spring-dm2.0.0.M1.
Working...
X