Skip to content

Instantly share code, notes, and snippets.

@afs
Created May 20, 2020 16:54
Show Gist options
  • Save afs/a862c0e71b37ce617cd0a592b60609f1 to your computer and use it in GitHub Desktop.
Save afs/a862c0e71b37ce617cd0a592b60609f1 to your computer and use it in GitHub Desktop.
Emergency fix for fuseki-server.jar in apache-jena-fuseki-3.15.0.zip
#!/bin/bash
# Replace file Log4j2Plugins.dat in fuseki-server.jar for the one
# in jena-fuseki-server.jar.
ROOT="https://repo1.maven.org/maven2/org/apache/jena"
VER=3.15.0
JAR="jena-fuseki-server-$VER.jar"
L4J="META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat"
JAR1=fuseki-server.jar
JAR2=fuseki-server-fix.jar
if [ ! -e "$JAR1" ]
then
echo "No $JAR1 found" 2>&1
exit1
fi
rm -f "$JAR2"
if [ ! -e "$L4J" ]
then
# Get the artifact with the working Log4j2Plugins.dat
# Download once.
wget -nc "$ROOT/jena-fuseki-server/$VER/jena-fuseki-server-$VER.jar"
unzip jena-fuseki-server-$VER.jar $L4J
fi
# Ensure it is "newer" for zip -u
touch "$L4J"
cp "$JAR1" "$JAR2"
## echo "## Ignore 'CRC does not match'"
## zip -f "$JAR2" "$L4J"
## Alternative: slower, no warning
jar -uf "$JAR2" "$L4J"
echo "Fixed jar: $JAR2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment