kotlinx-lincheck icon indicating copy to clipboard operation
kotlinx-lincheck copied to clipboard

Slf4j incompatibility

Open CLOVIS-AI opened this issue 2 years ago • 3 comments
trafficstars

When running a test which uses Slf4J's LoggerFactory.getLogger, the test fails (in both stress-testing and model-testing) with:

java.lang.reflect.InvocationTargetException
Caused by: javax.xml.parsers.FactoryConfigurationError: Provider com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl could not be instantiated: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory
Caused by: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory

Full stack trace | Source commit.

Full reproduction

Scripted as a Dockerfile for ease of use, but should do the same with any Java installation:

FROM archlinux:base

# Requires a working JRE
RUN pacman -Syuu --noconfirm git jre-openjdk
ENV JAVA_HOME=/usr/lib/jvm/default-runtime

# Checkout the project
RUN mkdir -p /opt
RUN git clone https://gitlab.com/opensavvy/pedestal.git /opt/pedestal
WORKDIR /opt/pedestal
RUN git switch --detach 1c5c820f

# Run the JVM tests
RUN ./gradlew cache:jvmTest

It seems a common pattern that Lincheck fails with logging libraries (#133, #116), but the error message is quite different, so I don't know if it's the same underlying problem or not.

CLOVIS-AI avatar Apr 21 '23 21:04 CLOVIS-AI

The issue will likely be automatically resolved with #136

ndkoval avatar Jan 17 '24 21:01 ndkoval

Hi, @CLOVIS-AI! It has taken a while to address the issue, but the recent 2.30 release should've fixed it. Could you please check?

ndkoval avatar Apr 29 '24 18:04 ndkoval

Hi! Indeed, it seems to work, now.

Well, at least, it runs, takes some time, and then ends without printing any errors. Can you take a quick look at the test in case I wrote it incorrectly :pray:?

CLOVIS-AI avatar May 04 '24 14:05 CLOVIS-AI

@CLOVIS-AI, the test looks good to me!

Since the issue has been fixed, I'm closing it now.

ndkoval avatar May 29 '24 07:05 ndkoval