Plugin method call "NoSuchFieldError : actualValueType" exception
Hi all! I'm trying to develop a plugin to interact with Jena ( http://jena.sourceforge.net), a semantic web framework. I developed the plugin as I documented it in the plugin development tutorial. I have a hello() method which works perfectly. however when I try to call this method: public List<String> test1(){ Vector<String> uris = new Vector<String>(); OntModel model = ModelFactory.createOntologyModel( OntModelSpec.RDFS_MEM_RDFS_INF, null ); model.read(" http://www.dcs.shef.ac.uk/~zzc05jb/environmentOntology/pollutionInventory.rd... "); model.read(" http://www.dcs.shef.ac.uk/~zzc05jb/environmentOntology/instances/disposalRec... "); Iterator iter = model.listIndividuals(); while(iter.hasNext()){ OntResource ontClass = (OntResource)iter.next(); uris.add(ontClass.getURI()); } return uris; } I get this exception: Error number 4001 in 4: Error while parsing velocity page Tests.OntologyPlugin Wrapped Exception: Invocation of method 'test1' in class secoia.plugin.OntologyPluginApi threw exception class java.lang.NoSuchFieldError : actualValueType I can't really make sense of it. This method works if i use it form a classic Java application. I copied all the Jena jar files to the webapps/xwiki/WEB-INF/lib directory. Moreover, I don't know where this actualValueType comes from. Does it come from XWiki? Any clue on this problem? Thanks a lot! -- _ _ Julien Bourdon (o)(o)--. http://purl.org/net/JulienBourdon \../ ( ) self isAddictedTo:(#Squeaklinux) m\/m--m'`--. ^true
I resolved this tricky problem. Jena and XWiki both use Xerces. I found the actualValueType field in the xerces API ( http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/impl/d... ). . The fact is that it seems that XWiki uses a jar file which is less complete than the one provided by Jena (called xercesImpl.jar). I therefore deleted <http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/lib/xerces-2.4.0.jar?view=log&rev=468> xerces-2.4.0.jar from WEB-INF/lib and replaced it with the one provided by xerces. However, this looks more like a hack to a real solution. Does anyone know where I could configure XWiki to give priority to the Jena jar when I call my plugin rather than to the XWiki one? Thanks a lot! On 05/04/06, Julien Bourdon <[email protected]> wrote:
Hi all!
I'm trying to develop a plugin to interact with Jena ( http://jena.sourceforge.net), a semantic web framework.
I developed the plugin as I documented it in the plugin development tutorial. I have a hello() method which works perfectly. however when I try to call this method:
public List<String> test1(){ Vector<String> uris = new Vector<String>(); OntModel model = ModelFactory.createOntologyModel( OntModelSpec.RDFS_MEM_RDFS_INF, null ); model.read(" http://www.dcs.shef.ac.uk/~zzc05jb/environmentOntology/pollutionInventory.rdfs<http://www.dcs.shef.ac.uk/%7Ezzc05jb/environmentOntology/pollutionInventory.rdfs> "); model.read(" http://www.dcs.shef.ac.uk/~zzc05jb/environmentOntology/instances/disposalRecoveryMethods.rdf<http://www.dcs.shef.ac.uk/%7Ezzc05jb/environmentOntology/instances/disposalRecoveryMethods.rdf> "); Iterator iter = model.listIndividuals(); while(iter.hasNext()){ OntResource ontClass = (OntResource)iter.next(); uris.add(ontClass.getURI()); } return uris; }
I get this exception:
Error number 4001 in 4: Error while parsing velocity page Tests.OntologyPlugin Wrapped Exception: Invocation of method 'test1' in class secoia.plugin.OntologyPluginApi threw exception class java.lang.NoSuchFieldError : actualValueType
I can't really make sense of it. This method works if i use it form a classic Java application. I copied all the Jena jar files to the webapps/xwiki/WEB-INF/lib directory. Moreover, I don't know where this actualValueType comes from. Does it come from XWiki?
Any clue on this problem?
Thanks a lot!
-- _ _ Julien Bourdon (o)(o)--. http://purl.org/net/JulienBourdon \../ ( ) self isAddictedTo:(#Squeaklinux) m\/m--m'`--. ^true
-- _ _ Julien Bourdon (o)(o)--. http://purl.org/net/JulienBourdon \../ ( ) self isAddictedTo:(#Squeaklinux) m\/m--m'`--. ^true
The only way to solve this cleanly would be to package your plugn using a tool like jarjar which embeds jar from modules inside a global jar. Groovy is packaged like that and it has solved conflicts on the asm jar with hibernate. It could make sense to upgrade Xerces in XWiki. Ludovic Julien Bourdon a écrit :
I resolved this tricky problem. Jena and XWiki both use Xerces. I found the actualValueType field in the xerces API (http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/impl/d... <http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/impl/dv/ValidatedInfo.html#actualValue>). . The fact is that it seems that XWiki uses a jar file which is less complete than the one provided by Jena (called xercesImpl.jar). I therefore deleted <http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/lib/xerces-2.4.0.jar?view=log&rev=468>xerces-2.4.0.jar from WEB-INF/lib and replaced it with the one provided by xerces.
However, this looks more like a hack to a real solution. Does anyone know where I could configure XWiki to give priority to the Jena jar when I call my plugin rather than to the XWiki one?
Thanks a lot!
On 05/04/06, *Julien Bourdon* <[email protected] <mailto:[email protected]>> wrote:
Hi all!
I'm trying to develop a plugin to interact with Jena (http://jena.sourceforge.net <http://jena.sourceforge.net>), a semantic web framework.
I developed the plugin as I documented it in the plugin development tutorial. I have a hello() method which works perfectly. however when I try to call this method:
public List<String> test1(){ Vector<String> uris = new Vector<String>(); OntModel model = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM_RDFS_INF, null );
model.read("http://www.dcs.shef.ac.uk/~zzc05jb/environmentOntology/pollutionInventory.rd... <http://www.dcs.shef.ac.uk/%7Ezzc05jb/environmentOntology/pollutionInventory.rdfs>"); model.read(" http://www.dcs.shef.ac.uk/~zzc05jb/environmentOntology/instances/disposalRec... <http://www.dcs.shef.ac.uk/%7Ezzc05jb/environmentOntology/instances/disposalRecoveryMethods.rdf>"); Iterator iter = model.listIndividuals(); while(iter.hasNext()){ OntResource ontClass = (OntResource)iter.next(); uris.add(ontClass.getURI()); } return uris; }
I get this exception:
Error number 4001 in 4: Error while parsing velocity page Tests.OntologyPlugin Wrapped Exception: Invocation of method 'test1' in class secoia.plugin.OntologyPluginApi threw exception class java.lang.NoSuchFieldError : actualValueType
I can't really make sense of it. This method works if i use it form a classic Java application. I copied all the Jena jar files to the webapps/xwiki/WEB-INF/lib directory. Moreover, I don't know where this actualValueType comes from. Does it come from XWiki?
Any clue on this problem?
Thanks a lot!
-- _ _ Julien Bourdon (o)(o)--. http://purl.org/net/JulienBourdon \../ ( ) self isAddictedTo:(#Squeaklinux) m\/m--m'`--. ^true
-- _ _ Julien Bourdon (o)(o)--. http://purl.org/net/JulienBourdon \../ ( ) self isAddictedTo:(#Squeaklinux) m\/m--m'`--. ^true ------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic
participants (2)
-
Julien Bourdon -
Ludovic Dubost