I have a web app, which runs in tomcat8 using log4j2. The app works correctly.

Now I am trying to add the ability to write a PDF file from the app, using pdfbox-app-2.00.jar.

First, I wrote a testbed program to verify that I can generate a valid PDF. In order to make it work, I downloaded Apache's commons-logging-1.2-bin.zip and added commons-logging-1.2.jar to the testbed classpath. That testbed now works.

So now I'm trying to make it work within the webapp.

I have added both the pdfbox and commons-logging jars to the webapps classpath, and I have imported pdfbox classes into the app. The log4j libraries are contained in the webapp's WEB-INF/lib folder.

When I launch the app, I get a bunch of logging TRACE messages about "trying to find" various forms of log4j2 properties, like the follo0wing...

TRACE StatusLogger Trying to find [log4j2-test/iBook.properties] using context class loader WebappClassLoader
  context: iBook
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@42f30e0a
.

...then an ERROR message that no log4j2 configuration could be found.

There is a valid log4j2 configuration XML in tomcat's conf directory, which the webapp is able to find and use.

After these messages, the webapp starts.

But as soon as I try to log in to the app, it fails, because it was unable to authenticate the user (the app uses JAAS authentication, which is apparently being blocked by the PdfBox/log4j2 problem).

All of this happens only after I add PdfBox to the app, which otherwise works fine.

Do you have any insight to offer as to what might be the conflict?

Are PdfBox and Log4j2 incompatible?

I see the same behavior if I remove the commons-logging reference from the classpath, leaving just PdfBox and Log4j2.

Thanks,

Jerry

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to