botsing icon indicating copy to clipboard operation
botsing copied to clipboard

Log4j error when using Botsing

Open MaelAudren opened this issue 5 years ago • 4 comments

Characteristics

  • Issue Type: [bug, test report]
  • Reproducibility: [always]
  • Severity: [minor]
  • Tool/Service/Component: [Botsing, v1.0.3]
  • Execution Environment: [Ubuntu 18.04]
  • Reporter: [Mael Audren, [email protected]]

Description

Error logs appears in Botsing during its run.

log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by 
log4j:ERROR [org.evosuite.instrumentation.InstrumentingClassLoader@7408eac5] whereas object of type 
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [org.gradle.internal.classloader.MutableURLClassLoader@3d646c37].
log4j:ERROR Could not instantiate appender named "CONSOLE".

Steps to reproduce

https://github.com/STAMP-project/evocrash-usecases-output/tree/master/Activeeon/Botsing/v1.0.3/scheduling

Other files and URLs

Log file: https://github.com/STAMP-project/evocrash-usecases-output/blob/master/Activeeon/Botsing/v1.0.3/scheduling/SpaceNotFoundException/SpaceNotFound.log

MaelAudren avatar Feb 22 '19 16:02 MaelAudren

Hi @MaelAudren,

From the error message, there seems to be a conflict in the classloaders. The same class loaded by two different class loaders. The shadowing performed when building the project (introduced in botsing-1.0.3) addresses this problem.

I saw that there is now also a shadowing step in the Gradle build, but it does not seem to work properly. When building the plugin with Gradle. I decompressed the fat .jar file and the packages are not relocated to avoid conflicts in the class loaders.

I think this https://imperceptiblethoughts.com/shadow/configuration/relocation/#filtering-relocation and the list of relocated packages might help: https://github.com/STAMP-project/botsing/blob/fb6e61152d139e25e9867947f2f721e5cdb51e77/pom.xml#L288-L399

xdevroey avatar Feb 26 '19 10:02 xdevroey

@xdevroey thanks for the help. How do you know if a package is reallocated or not ?

MaelAudren avatar Mar 04 '19 17:03 MaelAudren

I saw it by decompressing the fat .jar file produced by the plugin and checking that the directories tree does not contain the original packages hierarchy.

In the example I provided, you have the package prefix and the relocation (in org.evosuite.shaded). I strongly recommend you keep that same name because the EvoSuite library seems to have some hardcoded packages names comparison.

The Gradle plugin you are using seems to follow the same usage pattern as Maven (cf. link to the documentation).

xdevroey avatar Mar 05 '19 09:03 xdevroey

@xdevroey Those errors also appears when I launch Botsing manually however they are absolutely not the cause of the Botsing crash. The crash was provoked by an issue on the plugin I have just misunderstood the logs. I have updated the description to reflect better the issue.

MaelAudren avatar Mar 06 '19 15:03 MaelAudren