On 1/15/07, Marshall Schor <[EMAIL PROTECTED]> wrote:
A user posted a forum question on http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=444&thread=145870&cat=28 . That link has a trail of discussion that led to a resolution - the failing case involved the PEAR including in its lib/ subdirectory some UIMA framework Jars, such as uima-core.jar. The fix was to remove these from the lib/ subdirectory, and also remove any reference in the installation metadata for the classpath that referred to the UIMA frame Jars. The reason for all this is that an application must load only one set of UIMA framework Jars, under one class loader, in order to correctly work. The PEAR validation mechanism was using Pear tooling and information to set up a UIMA Extension class loader (part of the Resource management mechansim) and was including the UIMA framework Jars in the set of things to load using this class loader. The UIMA class loader follows the protocol of loading a class first from its specified URL list, rather than the protocol of delegate first to its parent - because it is intended to allow isolation of the loaded classes from others that might also be loaded (but at different "version" levels, etc.).
The PEAR validation code uses UIMA ResourceManager mechanism to add several JARs to the classpath, but it does not override the default class loader. Therefore, the 'extension' classes, which are specified in the component classpath, are searched in the extended classpath, but still are loaded by the default class loader - the same class loader that loads UIMA framework classes. I believe, the problem of including UIMA JARs in PEAR packages is, most likely, related to possible mixture of different versions of the UIMA code. In any case, PEAR packages should not include UIMA framework code. We need to consider updating our tooling to prevent other users from
encountering similar problems. -Marshall
My general opinion is - warn developers on possible conflicts, but let them go their own way. 1) I believe, PEAR Packager may post a warning that adding UIMA JARs to a PEAR package may lead to conflicts, but it should not prevent developers from doing this, because we cannot predict all possible uses of PEAR packages. The PEAR Packager may also warn that adding JARs from the 'lib' folder or adding the 'bin' folder to the CLASSPATH is not necessary (the JARs in the 'lib' folder and the 'bin' folder are added to the CLASSPATH automatically), but it should not prevent developers from doing this. 2) The buildComponentClassPath() method may also warn that the CLASSPATH contains duplicated entries, but it should not ignore them. The buildComponentClassPath() method does not control the names of the JARs added to the CLASSPATH, so I don't believe, it could discover UIMA JARs in the component CLASSPATH, because developers are free to use any names for their JARs. -- Lev
