This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Oct 4, 2011, 11:28 AM
4 Posts

Using third party Java with the XPages classloader

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: classloader jar getresource
  • Replies: 0
I've been tinkering with a third party Java library, the aim being to integrate it with XPages (this is in 8.5.2 by the way). I have employed the usual hacks to add the relevant JARs to the NSF (via WebContent/WEB-INF/lib), and then adding interaction classes in WebContent/WEB-INF/src. These classes are then referenced in my SSJS. So far so good. However, as soon as the classes need to do stuff like ClassLoader.getResource() it all becomes unstuck. I have seen the odd statement here and there about how getResource() calls fail for code running within the XPages engine—e.g. Stephan's post here:
  
When you use Class.getResource() inside a static method of a class you won't get access to any of the resources in the JAR. You need to have a normal instance of a class. 
 
 
… but I don't have enough of an understanding as to why this is the case. Specifically, I want my code to be able to load in things like XSL and image files from the referenced third party JAR file. Domino Java agents have no problem doing this via lotus.domino.AgentLoader. It's just the XPages classloader that has the issue. I suspect some weird combination of scope, security, and general incomplete implementation, but who knows for sure? All I do know is that the default classloader in the XPages engine always returns a null object reference for these ClassLoader.getResource() calls.
 
Any ideas, work-arounds or observations much appreciated. 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal