Reputation: 15739
In some XPages applications I'm trying to take advantage of org.apache.commons.lang package that is installed as part of Domino. I'm adding it into the plugin.xml in the requires section:
This allows me to use the package, and compiles the code and successfully runs it. I can refresh the design down onto test databases and, although I need to add the import statement in again because the design refresh process does not update the plugin.xml, this works on my development server (8.5.2 FP3 and has worked on 8.5.2 FP1 also).
However, when I try to run the same code on a different server, it fails with a ClassDefNotFoundError for org.apache.commons.lang. This has failed on a number of different Domino versions and multiple databases. If I clean the database and rebuild it, the code compiles fine, but at runtime the error is still thrown.
My development server's install is partitioned across two drives, but I would not expect that adding the import to the plugin.xml would store a filepath somewhere behind the scenes.
I also tried importing the jar into my database and adding it to the build path as a referenced library, but again got the ClassDefNotFoundError.
Any ideas of the cause or resolution would be gratefully accepted.
Upvotes: 0
Views: 874
Reputation: 15739
Far from ideal, but I created a folder under WebContent\WEB-INF called lib and import the jar file into that. The lib folder in this path gets automatically included in the Build Path, so anything in that folder automatically becomes available. After speaking to others, this may get loaded by another ClassLoader, so doesn't conflict with the server version. It's not ideal, but I know of a couple of people working on a better solution for this and other Apache library issues, so hopefully that's coming soon. I'll add a comment when the better solution is available.
Upvotes: 1
Reputation: 8086
My recommendation would be to create an empty XSP library that specifies the necessary dependency, then set it to be a global library (in other words, you wouldn't have to explicitly set it as a dependency for each application). This is obviously overkill, but it would almost certainly work.
Upvotes: 0