eclipse - Spring bean loading issue in BIRT designer -
i have issue spring not loading beans correctly when run script in birt scripted data source, running ok on own.
here's minimal test case:
the spring bean:
package test; import org.springframework.stereotype.component; @component public class testcomponent { }
the context provider:
package test; import org.springframework.context.applicationcontext; import org.springframework.context.support.classpathxmlapplicationcontext; public class springcontextholder { private static applicationcontext ac; public static applicationcontext getapplicationcontext() { if( ac == null ) { ac = new classpathxmlapplicationcontext("classpath:beans.xml"); } return ac; } }
beans.xml:
<beans .......> <context:component-scan base-package="test"></context:component-scan> <context:annotation-config /> </beans>
and test program simple eclipse java project having spring , related jars , test.jar above in build path:
public class cltest { public static void main(string[] args ) throws beansexception { system.out.println(test.springcontextholder.getapplicationcontext().getbean("testcomponent")); } }
this program runs fine , delivers bean. when run same jars in birt designer (4.3.0) setting them in report classpath preferences, exception:
a birt exception occurred. see next exception more information. wrapped org.springframework.beans.factory.beandefinitionstoreexception: failed read candidate component class: url [jar:file:/c:/users/xxx/.m2/repository/test/test/0.0.1-snapshot/test-0.0.1-snapshot.jar!/test/springcontextholder.class]; nested exception java.lang.arrayindexoutofboundsexception: 6
the script source simply:
importpackage(packages.test); ts = springcontextholder.getapplicationcontext().getbean("testcomponent");
the exception results org.springframework.asm.classreader readshort violates array boundaries. spring version 3.2.3 release, oracle java 7u25, birt designer 4.3.0.
can explain difference between 2 running scenarios is? class loader issues when jars loaded eclipse runtime?
Comments
Post a Comment