TDBFactory的java.lang.ClassCastException

时间:2015-07-22 01:10:39

标签: java jena

我用Jena为我的数据制作了一个tdb索引。 为了在查询时引用数据,我尝试使用TDBFactoryModel(下面给出的两个语句)。我对两者都有相同的异常,所以这似乎与我写的语句无关。

Dataset dataset = TDBFactory.createDataset(directory) ;

Model model=FileManager.get().loadModel(directory);

运行时异常是:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.reset(RDFReaderFImpl.java:81)
    at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.<clinit>(RDFReaderFImpl.java:74)
    at com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:54)
    at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:114)
    at com.hp.hpl.jena.vocabulary.OWL.<clinit>(OWL.java:36)
    at com.hp.hpl.jena.sparql.graph.NodeConst.<clinit>(NodeConst.java:29)
    at com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderFixed.<clinit>(ReorderFixed.java:23)
    at com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderLib.fixed(ReorderLib.java:53)
    at com.hp.hpl.jena.tdb.sys.SystemTDB.<clinit>(SystemTDB.java:187)
    at com.hp.hpl.jena.tdb.TDB.<clinit>(TDB.java:90)
    at com.hp.hpl.jena.tdb.setup.DatasetBuilderStd.<clinit>(DatasetBuilderStd.java:64)
    at com.hp.hpl.jena.tdb.StoreConnection.make(StoreConnection.java:227)
    at com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.<init>(DatasetGraphTransaction.java:75)
    at com.hp.hpl.jena.tdb.sys.TDBMaker._create(TDBMaker.java:57)
    at com.hp.hpl.jena.tdb.sys.TDBMaker.createDatasetGraphTransaction(TDBMaker.java:45)
    at com.hp.hpl.jena.tdb.TDBFactory._createDatasetGraph(TDBFactory.java:104)
    at com.hp.hpl.jena.tdb.TDBFactory.createDatasetGraph(TDBFactory.java:73)
    at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:52)
    at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:48)

Caused by: java.lang.ClassCastException: org.apache.xerces.dom.DeferredTextImpl cannot be cast to org.w3c.dom.Element
    at sun.util.xml.PlatformXmlPropertiesProvider.importProperties(PlatformXmlPropertiesProvider.java:118)
    at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:90)
    at java.util.Properties$XmlSupport.load(Properties.java:1201)
    at java.util.Properties.loadFromXML(Properties.java:881)
    at com.hp.hpl.jena.util.Metadata.read(Metadata.java:76)
    at com.hp.hpl.jena.util.Metadata.addMetadata(Metadata.java:54)
    at com.hp.hpl.jena.util.Metadata.<init>(Metadata.java:48)
    at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:34)

我使用的jar文件是:

arq-2.8.7.jar,
commons-cli-1.2.jar,
commons-codec-1.6.jar,
commons-collections-3.2.1.jar,
commons-csv-1.0.jar,
commons-io-2.4.jar,
commons-lang3-3.1.jar,
commons-math3-3.0.jar,
httpclient-4.2.6.jar,
httpclient-cache-4.2.6.jar,
httpcore-4.2.5.jar,
jackson-annotations-2.3.0.jar,
jackson-core-2.3.3.jar,
jackson-databind-2.3.3.jar,
jcl-over-slf4j-1.7.6.jar,
jena-arq-2.12.1.jar,
jena-core-2.12.1.jar,
jena-iri-1.1.1.jar,
jena-sdb-1.5.1.jar,
jena-tdb-1.1.1.jar,
jgraph.jar,
jsonld-java-0.5.0.jar,
libthrift-0.9.1.jar,
log4j-1.2.17.jar,
slf4j-api-1.7.6.jar,
slf4j-log4j12-1.7.6.jar,
xercesImpl-2.11.0.jar,
xml-apis-1.4.01.jar

我该如何解决这个问题?

0 个答案:

没有答案