Reputation: 658
I have a Java 8 application running in Weblogic 12.1.3. The application uses iText 5.5.9 and minimum version of BC required is 1.49 . The application is deploying as a WAR file in Weblogic . I could see the war file is having the proper version of BC . But during run time its taking from WebLogic maven plugin path and using BC 1.45. Is there any way we can avoid this by editing POM entry or by editing WebLogic.xml . If i remove BC 1.45 jar from my local server its running successfully. But i cannot remove the jar from higher environment server . So Please help. Thanks.
Upvotes: 1
Views: 1841
Reputation: 77528
This is a known problem. BC broke their API in-between versions, and when you have two different BC versions in your CLASSPATH, you can get very strange errors (which might differ depending on which version was loaded first). I see that you're still using the old iText (not iText 7), which means you can switch to iTextG.
The G in iTextG stands for Google, and iTextG was created to avoid some problems. For instance:
BouncyCastle and SpongyCastle are identical, except for their package names and the name of the security provider ("BC" versus "SC"). Because of these differences, two different versions, such as version 1.45 of BC in WebLogic and version 1.49 of SpongyCastle in your iTextG application won't clash.
This was necessary for use of iText on Android, because Android shipped with an old version of BC (just like your WebLogic ships with an old version).
Upvotes: 1