javadocuments4j

java.lang.IllegalAccessError: class org.slf4j.LoggerFactory tried to access private field org.slf4j.impl.StaticLoggerBinder.SINGLETON


i am trying to convert MS word to PDF using documents4j. using a java program, compiling and running the code through cmd the file is being generated with no issues.

however, when i am running the same file on tomcat, i am getting the below error:

java.lang.IllegalAccessError: class org.slf4j.LoggerFactory tried to access private field org.slf4j.impl.StaticLoggerBinder.SINGLETON (org.slf4j.LoggerFactory and org.slf4j.impl.StaticLoggerBinder are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @573c1e91)

all jar files are of same version and compile/run as mentioned before on cmd.

slf4j-api 1.7.28. slf4j-log4j12 1.7.28. slf4j-simple 1.7.28.

File wordFile = new File(FILE_NAME), target = new File(outputFile1);
IConverter converter = LocalConverter.builder().baseFolder(new File(path+"batimp"+slash))
.workerPool(20, 25, 2, TimeUnit.SECONDS)
.processTimeout(5, TimeUnit.SECONDS).build();
Future<Boolean> conversion = converter.convert(wordFile).as(DocumentType.DOCX).to(target).as(DocumentType.PDF)
.schedule();
converter.shutDown();

Can you advise what am i missing?


Solution

  • have placed slf4j-jdk14-1.7.28.jar instead of slf4j-log4j12-1.7.28 solved the issue