How to avoid bcprov-jdk16-1.45.jar while running the application through POM entry

只愿长相守 提交于 2021-01-28 10:58:36

问题


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.


回答1:


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:

  • Java classes that aren't whitelisted for use on GAE or Android were removed,
  • Specific file operations that don't make sense in a cloud context were adapted,
  • Bouncycastle was replaced with SpongyCastle.

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).



来源:https://stackoverflow.com/questions/49682961/how-to-avoid-bcprov-jdk16-1-45-jar-while-running-the-application-through-pom-ent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!