Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Problem during deployment of Protege Plugin

Götz Fabian goetz.fabian at gmail.com
Wed Dec 15 03:00:08 PST 2010


It works! Thank you so much, that was exactly the code I needed to insert.
For reference, this is the source of FactoryLocator from the Apache Software Foundation with the correct line numbers:


Thanks again,
Götz

On 14.12.2010, at 17:57, Timothy Redmond wrote:

> 
> I finally found some sources for a FactoryLocator that might be the one you are using.  The line numbers don't correspond and I can't be sure but if this is the one then the relevant lines are:
> 
> 	static Object locate(String factoryId, String altClassName)
> 			throws FactoryConfigurationError {
> 		return locate(factoryId, altClassName,
>                               Thread.currentThread().getContextClassLoader());
> 	}
> 
> This suggests that your problem will go away if you set the context class loader to something that can load the WstxInputFactory.  So you would figure out the point at which this code is invoked (might be tricky...) and call
> 
> Thread.currentThread().setContextClassLoader(Foo.class.getClassLoader());
> 
> where Foo is a class defined in your bundle (e.g. Foo.class.getClassLoader() is a class loader that sees the WstxInputFactory class.
> 
> 
> Let me know if this does or does not work.  In retrospect I should have suggested it right away, the setContextClassLoader idea is a bit of a convention in Java.
> 
> -Timothy
> 
> [1] http://tinyurl.com/26ffeta
> 
> 
> On 12/13/2010 05:54 PM, Timothy Redmond wrote:
>> 
>> 
>> I knew that I had lost track of this e-mail.  I don't know the answer but I have seen things like this before.  My reply rambles a bit because I don't have a solution for you yet.
>> 
>> This looks like a case of the javax.xml.stream.FactoryLocator class doing some magic with class loaders which is not working with the OSGi environment.  One of the indicators of this is that it is indicating that it is using the sun.misc.Launcher$AppClassLoader class loader.  This is probably the system class loader.  The class loaders for the bundles (Protege plugins) would print out as something like
>> 
>> (org.apache.felix.framework.ModuleImpl$ModuleClassLoader) 11.0
>> 
>> Your WstxInputFactory class probably loads correctly in the bundle context.
>> 
>> It might help to find the source for the javax.xml.stream.FactoryLocator.  This might tell you how to either pre-register the WstxInputFactory or to change the class loader that the FactoryLocator is using.  I don't think that this class is a standard java thing.  I noticed that the source in [1] does not correspond to the code that you are running.  This is probably the next step in debugging and I suspect this source can be found in the axis 2 project.  If you find it send it and I will see if this helps.
>> 
>> Another tool that can be helpful is the attached org.protege.osgi.debug plugin.  Dump it in the plugins directory and start Protege.  You can then see what bundles are able to load which classes.  There are some instructions on how to use this tool here [2].  In particular you can double check that your bundle can load the WstxInputFactory class.
>> 
>> -Timothy
>> 
>> [1] http://kickjava.com/src/javax/xml/stream/FactoryLocator.java.htm
>> [2] http://protegewiki.stanford.edu/wiki/SolvingClassLoaderProblems
>> 
>> 
>> On 12/10/2010 07:06 AM, Götz Fabian wrote:
>>> 
>>> Hello everyone,
>>> 
>>> I'm experiencing some trouble during deployment of a Protege plugin. Building and running it (using the Ant script) works flawlessly in Eclipse. However, when I copy the resulting jar file into the plugins folder of Protege and launch it, the following exception is thrown twice:
>>> 
>>> javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located.  Classloader =sun.misc.Launcher$AppClassLoader at 546b97fd
>>> 	at javax.xml.stream.FactoryLocator.loadFactory(FactoryLocator.java:120)
>>> 	at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:109)
>>> 	at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:54)
>>> 	at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:41)
>>> 	at org.apache.axiom.om.util.StAXUtils$7.run(StAXUtils.java:311)
>>> 	at java.security.AccessController.doPrivileged(Native Method)
>>> 	at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_perClassLoader(StAXUtils.java:306)
>>> 	at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:76)
>>> 	at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:131)
>>> 	at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:596)
>>> 	at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:581)
>>> 	at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
>>> 	at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:86)
>>> 	at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:641)
>>> 	at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
>>> 	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
>>> 	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
>>> 	at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)
>>> 	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143)
>>> 
>>> com.ctc.wstx.stax.WstxInputFactory is included in a supplied jar, which you can also find here:
>>> http://www1.inf.tu-dresden.de/~s2715005/gopubmed-ontology-generation-service-clients-jar-with-dependencies.jar
>>> Other classes are successfully loaded from this jar file, with the exception of WstxInputFactory.
>>> 
>>> Has anyone experienced a similar problem? Is there some magic in the class/bundle loading of Protege?
>>> 
>>> Thank you for any kind of help or advice!
>>> Götz
> 
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
> 
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101215/a8c6a732/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FactoryLocator.java
Type: application/octet-stream
Size: 4305 bytes
Desc: not available
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101215/a8c6a732/attachment.java>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101215/a8c6a732/attachment-0001.html>


More information about the protege-discussion mailing list