Re: protege 4 plugin question

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: protege 4 plugin question

Timothy Redmond

In looking over my message again - I am thinking that the key may be  
my paragraph that says "the NoClassDefFoundError is very different  
from the ClassNotFoundException."  You are loading the class you want  
but some exception is being thrown immediately after that.

> Hi, Timothy,
> I am trying to modify the  
> and I overridden the handleLoadFrom (URI uri) method to let it  
> create an object of my version OntologyManager and load the ontology  
> using my code.

I am not sure that this is an approach for the faint of heart - the  
OWLEditorKit seems a little too fundamental to override.  Maybe  
someone else will have a comment on this  approach.  If your goal is  
to get into the protege welcome frame, I don't know  another way to do  
this.  If you really want to do this you will probably need to create  
an editor kit factory.  I would recommend thinking of another approach.

My first thought  would have been that you would  want a project menu  
plugin (similar to the plugin [1]).  People will load the uri your way  
by clicking the menu item.

In terms of understanding the class loader  issues,  the


class will be exported by the org.protege.editor.owl plugin.  All a  
plugin needs to do to see this class is import its package in the  

> I added the jar file under the lib directory and set the classpath  
> in the manifest file.

What did you add to the classpath in the manifest file?  If you are  
trying to load the class


then this class will be provided by Protege 4.  It is provided by the  
org.protege.editor.owl plugin which is  supplied.

> It can be built without any problem but after I try to load an  
> ontology from an URI,  I got the NoClassDefFoundError.

Ok - two things.  First, what are you doing to run the plugin?   Are  
you following one of the directions on one of our web sites?  Are you  
building  the jar, adding it to the protege 4 plugins directory and  
running it?  Are you using the eclipse OSGi support?

Second - and this is my mistake - the NoClassDefFoundError is very  
different from the ClassNotFoundException.  I got them confused in my  
previous message.  The NoClassDefFoundError usually - in my experience  
- means that the class loader found the class.  But something else  
went wrong shortly after  that.  For instance NoClassDefFoundError's  
are often caused by static initializers failing.  Perhaps if you sent  
me  the full exception trace it would help me understand what went  
wrong.  Also a gander at your manifest might help.

>   I also set the jar file from eclipse too.

For building or for running?  Which jar?

I am wondering if you are trying something funny to run your plugin.  
Our documentation does need some work but you can use our examples as  
a baseline for learning out to run a plugin.  They can be checked out  
from svn at [1] and [2].  They include build scripts so they can be  
minimally run by

1. setting the PROTEGE_HOME environment to point to a Protege 4  
distribution (use the latest build from [3])
2. installing the plugin with ant install
3. running Protege 4.

The plugins should then show up - [1] creates a menu item in the File  
menu and [2] creates a tab that needs to be enabled through the Tabs  
menu.  The plugin [2] is talked about in more detail in [5].

This gives a baseline and you can then start trying to run them from  
within your development environment.  (I noticed a problem in [1]  
which I just fixed.  So if you already have [1] you will need to  
update.)  Also you may have read [4,5] already but I figure I would  
give them a mention.


[1] http://smi-protege/repos/protege/protege4/examples/trunk/ 
[2] http://smi-protege/repos/protege/protege4/examples/trunk/

> Any where else I should set the path?
> Thanks,
> Cui

p4-feedback mailing list
[hidden email]