简体   繁体   中英

Applet dependency JARs with incompatible Class-Path in MANIFEST.MF

my applet depends on two JAR libraries. Each JAR library has a dependency on xercesImpl-2.2.1.jar. Unfortunately they want this to have different names:

  • Apache FOP 0.20.5

    • Entry in META-INF/MANIFEST.MF: Class-Path: xercesImpl-2.2.1.jar...
  • Apache Xalan 2.4.1

    • Entry in META-INF/MANIFEST.MF: Class-Path: xercesImpl.jar...

xercesImpl-2.2.1.jar is specified in the tag. I can see in the Java console that it is downloaded successfully. However later the console shows an attempt to read xercesImpl.jar which does not exist. It must be getting this from the Xalan manifest because the web application code does not specify xercesImpl.jar anywhere. Obviously it actually already has the contents of this JAR available so it doesn't actually need to load it.

I am using Maven to manage dependencies and would like to continue using these two standard public open source libraries without hacking their manifests. Any suggestions for the best way to resolve this - or should I just live with the spurious error in the Java console?

I'm not a Maven maven, but you're probably best off leaving the dependencies alone and somehow giving your project a 'goal' which involves re-packaging one of the JAR files once they are 'in' your project.

Possibly one way to do it is to make 'repackaged JAR' artifact depends on the 'fop' artifact, and your project depends on the 'repackaged JAR' artifact. Something like that.

Here's my latest slightly hacky idea. I have created valid empty JAR files with no classes in them and called them the names of the entries in the Class-Path, eg xercesImpl.jar . I'm going to put them into src/main/webapp so they will be included in the right spot. Java plugin will then happily download them instead of logging an error.

This way I only have to hack the web content (which is a mess anyway) rather than mess with the library JAR files, the Maven dependencies or the build process.

Still open to any better suggestions...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM