HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › Custom PD4ML classloader
- This topic has 3 replies, 2 voices, and was last updated Oct 23, 2010
12:46:52 by PD4ML.
-
AuthorPosts
-
September 3, 2010 at 14:41#26449
Hi, PD4ML works great and I’ve successfully integrated it into my weblogic instance in a multi-threaded environment to perform real-time HTML to PDF conversion for archival purposes. I created a custom resource provider based on the article in this forum. My custom resource provider uses Java’s JAI to reencode images on the fly so JPGs can be compressed and the PDF size reduced. This is working well, but I have encountered one issue with using a custom resource provider.
In my weblogic instance, PD4ML seems to be dynamically loading my custom resource provider through the root classloader. My project consists of an ear, that is packed with several wars and jars. But the custom class is defined within a war within an ear. PD4ML only finds it when I take my custom class and its dependencies and put them in a separate jar on the server classpath, so PD4ML can load it with the root classloader.
That works, but it limits the resource provider’s integration with other project-specific classes that I would like to use such as loggers and custom property file readers, which are not accessible to the root classloader.
Is it possible to have PD4ML use a classloader for my custom resource provider other than the root classloader? Can it dynamically load my class through a classloader that I define? Can I add that as another property to the dynamic map?
As well, is there a published list of properties that can be added to the map?
Much thanks for a great app!
September 16, 2010 at 19:27#28194Current versions load the class like that:
[language=java:f8vh12om]Class c = Class.forName(className);
ResourceProvider provider = (ResourceProvider) c.newInstance();[/language:f8vh12om]We’ve just changed to
[language=java:f8vh12om]Class c;
try {
c = Class.forName(className);
} catch (ClassNotFoundException e) {
try {
c = Thread.currentThread().getContextClassLoader().loadClass(className);
} catch (ClassNotFoundException e1) {
c = ResourceCache.class.getClassLoader().loadClass(className);
}
}[/language:f8vh12om](ResourceCache is one of PD4ML classess)
In theory it should help. Please contact support pd4ml com if you have anything to add to the code or if you want to test it with your application before we released new version.
September 18, 2010 at 15:09October 23, 2010 at 12:46#28196The version implements the feature (v361b2) is already available for download.
-
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.