H Greg, the code you're referring to [1] is used essentially for OSGi deployments, where each bundle (the package jars) have their own Classloader and essentially that would create issues when trying to instantiate AEs whose classes are in different bundles than the one which "contains" the UIMA framework. The way it works is just that each bundle which needs to use UIMA has to declare its UIMA components into an OSGi activator extending the UIMABundleActivator and thus implementing the #classRegistered method, see an example:
@Override protected void classRegistered() { classLoaderRepository.registerComponent(SomeAnnotator.class); } In the code you've shown it seems you're redefining the Classloader instance to be used by UIMAFramework and also forcing it into the current thread, as far as I have seen this is often done in OSGi deployments but I wonder if that's your scenario or not, and if not which container are you trying to instantiate UIMA into so that we can better understand what's the linkage problem coming from. Regards, Tommas [1] : http://svn.apache.org/repos/asf/incubator/clerezza/trunk/uima/uima.utils/ 2013/2/7 Greg Holmberg <holmberg2...@comcast.net> > Hi Tommaso-- > > > Sorry for the direct email, but you seem to be the expert on combining > UIMA and Clerezza. > > I'm trying to generate RDF from my UIMA AE. I started with the code in > RDFCASConsumer.java and modified it to change the directory and file to > which the RDF is written. > > I put this in my AE and deployed it in UIMA, running in my own container. > This container does this: > > AnalysisEngine engine = UIMAFramework.produceAnalysisEngine(...); > ClassLoader uimaClassLoader = > engine.getResourceManager().getExtensionClassLoader(); > Thread thread = Thread.currentThread(); > thread.setContextClassLoader(uimaClassLoader); > engine.process(cas); > > When I run I get: > > Exception in thread "TAService Worker 0" java.lang.LinkageError: loader > constraint violation in interface itable initialization: when resolving > method > "org.apache.xerces.dom.ElementImpl.getSchemaTypeInfo()Lorg/w3c/dom/TypeInfo;" > the class loader (instance of > org/apache/uima/internal/util/UIMAClassLoader) of the current class, > org/apache/xerces/dom/ElementImpl, and the class loader (instance of > <bootloader>) for interface org/w3c/dom/Element have different Class > objects for the type m/TypeInfo; used in the signature > > > I see several issues in Clerezza about UIMA and classloaders, which you > have resolved. There's even a method that gets the classloader to be used > for XML parsing. > > So it seems like you've probably solved this problem related to Xerces and > classloaders. However, I can't find any documentation about how to use > your fix. > > Can you tell me what I need to do when creating my analysis engine and > setting the classloader in order to avoid this LinkageError? > > Thanks, > > > Greg Holmberg > > > >