botsing icon indicating copy to clipboard operation
botsing copied to clipboard

Problem with the class loader when calling static class initialisation method

Open xdevroey opened this issue 5 years ago • 3 comments

Running botsing-1.0.3 with ./dependencies containing all the jars of authzforce + all the deps I could get with maven dependency plugin:

java -jar /home/gibello/.m2/repository/eu/stamp-project/botsing-reproduction/1.0.3/botsing-reproduction-1.0.3.jar -crash_log /tmp/ex1.log -target_frame 4 -project_cp ./dependencies/

Produces the following error without stopping the execution:

09:28:06.718 [main] INFO  e.s.b.reproduction.CrashReproduction - Starting the dependency analysis. The number of detected jar files is 119.
Exception in thread "main" java.util.ServiceConfigurationError: org.ow2.authzforce.core.pdp.api.PdpExtension: Provider org.ow2.authzforce.core.pdp.testutil.ext.TestAttributeProvider$Factory not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
	at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323)
	at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at org.ow2.authzforce.core.pdp.impl.PdpExtensions.<clinit>(PdpExtensions.java)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at org.evosuite.setup.TestClusterUtils.getClass(TestClusterUtils.java:312)
	at org.evosuite.setup.TestClusterGenerator.initializeTargetMethods(TestClusterGenerator.java:663)
	at org.evosuite.setup.TestClusterGenerator.generateCluster(TestClusterGenerator.java:134)
	at org.evosuite.setup.DependencyAnalysis.analyze(DependencyAnalysis.java:118)
	at org.evosuite.setup.DependencyAnalysis.analyzeClass(DependencyAnalysis.java:132)
	at eu.stamp.botsing.reproduction.CrashReproduction.initializeTargetClass(CrashReproduction.java:200)
	at eu.stamp.botsing.reproduction.CrashReproduction.generateCrashReproductionTests(CrashReproduction.java:103)
	at eu.stamp.botsing.reproduction.CrashReproduction.execute(CrashReproduction.java:78)
	at eu.stamp.botsing.Botsing.parseCommandLine(Botsing.java:68)
	at eu.stamp.botsing.Botsing.main(Botsing.java:161)

Originally posted by @gibello in https://github.com/STAMP-project/botsing/issues/58#issuecomment-473199957

xdevroey avatar Mar 15 '19 10:03 xdevroey

Stack trace for botsing-reproduction is:

java.lang.RuntimeException: Failed to load XML schemas: [classpath:pdp.xsd]
	at org.ow2.authzforce.core.pdp.impl.SchemaHandler.createSchema(SchemaHandler.java:541)
	at org.ow2.authzforce.core.pdp.impl.PdpModelHandler.<init>(PdpModelHandler.java:159)
	at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:682)
	at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:699)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)

xdevroey avatar Mar 15 '19 10:03 xdevroey

Class org.ow2.authzforce.core.pdp.impl.PdpExtensions has a user defined static class initialiser. EvoSuite class loader seems unnable to load the class (?).

xdevroey avatar Mar 15 '19 14:03 xdevroey

Tried with target_frame 1: works fine with the 1.0.3 command line (at least, generates a test). But the 1.0.4-SNAPSHOT maven plugin does not seem to work: it does not seem to support multimodule projects ?

mvn eu.stamp-project:botsing-maven:1.0.4-SNAPSHOT:botsing -Dcrash_log=/tmp/ex1.log -Dtarget_frame=1

If run in authzforce/core, an error occurs: INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.250 s [INFO] Finished at: 2019-03-15T16:21:57+01:00 [INFO] Final Memory: 16M/208M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal eu.stamp-project:botsing-maven:1.0.4-SNAPSHOT:botsing (default-cli) on project authzforce-ce-core: Error executing Botsing: Classpath element does not exist on disk at: /home/gibello/STAMP/STAMP-project/authzforce/core/target/classes -> [Help 1]

If run inside modules directories (I tried them all), there is no error, but an empty test is generated. I never obtain a test, like with the command line.

gibello avatar Mar 15 '19 15:03 gibello