Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log4j error when using Botsing #47

Open
MaelAudren opened this issue Feb 22, 2019 · 4 comments
Open

Log4j error when using Botsing #47

MaelAudren opened this issue Feb 22, 2019 · 4 comments
Assignees
Labels
botsing This issue is related to botsing core components enhancement New feature or request

Comments

@MaelAudren
Copy link
Member

MaelAudren commented Feb 22, 2019

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, mael.audren@activeeon.com]

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

@xdevroey
Copy link
Member

xdevroey commented Feb 26, 2019

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:

botsing/pom.xml

Lines 288 to 399 in fb6e611

<relocations>
<relocation>
<pattern>org.objectweb.asm</pattern>
<shadedPattern>org.evosuite.shaded.org.objectweb.asm</shadedPattern>
</relocation>
<relocation>
<pattern>org.hibernate</pattern>
<shadedPattern>org.evosuite.shaded.org.hibernate</shadedPattern>
</relocation>
<relocation>
<pattern>org.hsqldb</pattern>
<shadedPattern>org.evosuite.shaded.org.hsqldb</shadedPattern>
</relocation>
<relocation>
<pattern>org.jboss</pattern>
<shadedPattern>org.evosuite.shaded.org.jboss</shadedPattern>
</relocation>
<relocation>
<pattern>org.springframework</pattern>
<shadedPattern>org.evosuite.shaded.org.springframework</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.logging</pattern>
<shadedPattern>org.evosuite.shaded.org.apache.commons.logging</shadedPattern>
</relocation>
<relocation>
<pattern>javassist</pattern>
<shadedPattern>org.evosuite.shaded.javassist</shadedPattern>
</relocation>
<relocation>
<pattern>antlr</pattern>
<shadedPattern>org.evosuite.shaded.antlr</shadedPattern>
</relocation>
<relocation>
<pattern>org.antlr</pattern>
<shadedPattern>org.evosuite.shaded.org.antlr</shadedPattern>
</relocation>
<relocation>
<pattern>org.dom4j</pattern>
<shadedPattern>org.evosuite.shaded.org.dom4j</shadedPattern>
</relocation>
<!--
<relocation>
<pattern>org.xml</pattern>
<shadedPattern>org.evosuite.shaded.org.xml</shadedPattern>
</relocation>
<relocation>
<pattern>org.w3c</pattern>
<shadedPattern>org.evosuite.shaded.org.w3c</shadedPattern>
</relocation>
-->
<relocation>
<pattern>org.aopalliance</pattern>
<shadedPattern>org.evosuite.shaded.org.aopalliance</shadedPattern>
</relocation>
<relocation>
<pattern>org.mockito</pattern>
<shadedPattern>org.evosuite.shaded.org.mockito</shadedPattern>
</relocation>
<relocation>
<pattern>net.bytebuddy</pattern>
<shadedPattern>org.evosuite.shaded.net.bytebuddy</shadedPattern>
</relocation>
<relocation>
<!-- This is special. Originally we wanted to handle it directly, but
did not turn out to be a good idea. However, too early to remove
that code, so we just shade this package to avoid backward
compatibility issues
-->
<pattern>javax.servlet</pattern>
<shadedPattern>org.evosuite.shaded.javax.servlet</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache</pattern>
<shadedPattern>org.evosuite.shaded.org.apache</shadedPattern>
<excludes>
<!-- Important, otherwise AntInitializingListener would not work in Ant -->
<exclude>org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter</exclude>
<exclude>org.apache.tools.ant.taskdefs.optional.junit.JUnitTest</exclude>
<exclude>org.apache.tools.ant.BuildException</exclude>
<exclude>org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor</exclude>
</excludes>
</relocation>
<relocation>
<pattern>org.hamcrest</pattern>
<shadedPattern>org.evosuite.shaded.org.hamcrest</shadedPattern>
</relocation>
<relocation>
<pattern>org.objenesis</pattern>
<shadedPattern>org.evosuite.shaded.org.objenesis</shadedPattern>
</relocation>
<relocation>
<pattern>be.vibes</pattern>
<shadedPattern>org.evosuite.shaded.be.vibes</shadedPattern>
</relocation>
<relocation>
<pattern>be.yami</pattern>
<shadedPattern>org.evosuite.shaded.be.yami</shadedPattern>
</relocation>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>org.evosuite.shaded.com.google</shadedPattern>
</relocation>
<!--<relocation>-->
<!--<pattern>org.slf4j</pattern>-->
<!--<shadedPattern>org.evosuite.shaded.org.slf4j</shadedPattern>-->
<!--</relocation>-->
<!--<relocation>-->
<!--<pattern>ch.qos.logback</pattern>-->
<!--<shadedPattern>org.evosuite.shaded.ch.qos.logback</shadedPattern>-->
<!--</relocation>-->
</relocations>

@MaelAudren
Copy link
Member Author

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

@xdevroey
Copy link
Member

xdevroey commented Mar 5, 2019

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).

@MaelAudren
Copy link
Member Author

MaelAudren commented Mar 6, 2019

@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.

@xdevroey xdevroey added bug Something isn't working botsing This issue is related to botsing core components labels Mar 22, 2019
@pderakhshanfar pderakhshanfar added enhancement New feature or request and removed bug Something isn't working labels Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
botsing This issue is related to botsing core components enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants