我在我的项目源代码中导入了库,以便更改库的某些部分。 但是当我启动程序时,我得到以下异常:
线程“AWT-EventQueue-0”中的异常java.lang.ExceptionInInitializerError 在impl.owls.OWLSConverters.registerConverters(OWLSConverters.java:138)
这是OWLSConverters.java:
class OWLSConverters
{
static final void registerConverters(final OWLObjectConverterRegistry registry)
{
final OWLObjectConverter<Service> serviceConverter =
new GenericOWLConverter<Service>(ServiceImpl.class, OWLS.Service.Service);
final OWLObjectConverter<Profile> profileConverter =
new GenericOWLConverter<Profile>(ProfileImpl.class, OWLS.Profile.Profile);
final OWLObjectConverter<Actor> actorConverter =
new GenericOWLConverter<Actor>(ActorImpl.class, OWLS.Actor.Actor);
final OWLObjectConverter<ServiceParameter> serviceParamConverter =
new GenericOWLConverter<ServiceParameter>(ServiceParameterImpl.class, OWLS.ServiceParameter.ServiceParameter);
final OWLObjectConverter<ServiceCategory> serviceCategoryConverter =
new GenericOWLConverter<ServiceCategory>(ServiceCategoryImpl.class, OWLS.ServiceCategory.ServiceCategory);
final OWLObjectConverter<AtomicProcess> atomicProcessConverter =
new GenericOWLConverter<AtomicProcess>(AtomicProcessImpl.class, OWLS.Process.AtomicProcess);
final OWLObjectConverter<CompositeProcess> compositeProcessConverter =
new GenericOWLConverter<CompositeProcess>(CompositeProcessImpl.class, OWLS.Process.CompositeProcess);
final OWLObjectConverter<SimpleProcess> simpleProcessConverter =
new GenericOWLConverter<SimpleProcess>(SimpleProcessImpl.class, OWLS.Process.SimpleProcess);
final List<OWLObjectConverter<? extends Process>> prCs =
new ArrayList<OWLObjectConverter<? extends Process>>(3);
prCs.add(atomicProcessConverter);
prCs.add(compositeProcessConverter);
prCs.add(simpleProcessConverter);
final OWLObjectConverter<Process> processConverter = new CombinedOWLConverter<Process>(Process.class, prCs);
final OWLObjectConverter<Existential> existentialConverter =
new GenericOWLConverter<Existential>(ExistentialImpl.class, OWLS.Process.Existential);
final OWLObjectConverter<Input> inputConverter =
new GenericOWLConverter<Input>(InputImpl.class, OWLS.Process.Input);
final OWLObjectConverter<Output> outputConverter =
new GenericOWLConverter<Output>(OutputImpl.class, OWLS.Process.Output);
final OWLObjectConverter<Link> linkConverter =
new GenericOWLConverter<Link>(LinkImpl.class, OWLS.Process.Link);
final OWLObjectConverter<Loc> locConverter =
new GenericOWLConverter<Loc>(LocImpl.class, OWLS.Process.Loc);
final OWLObjectConverter<Participant> participantConverter =
new GenericOWLConverter<Participant>(ParticipantImpl.class, OWLS.Process.Participant);
final OWLObjectConverter<ResultVar> resultVarConverter =
new GenericOWLConverter<ResultVar>(ResultVarImpl.class, OWLS.Process.ResultVar);
final List<OWLObjectConverter<? extends Local>> localCs =
new ArrayList<OWLObjectConverter<? extends Local>>(2);
localCs.add(locConverter);
localCs.add(linkConverter);
final OWLObjectConverter<Local> localConverter =
new CombinedOWLConverter<Local>(Local.class, localCs);
final List<OWLObjectConverter<? extends Parameter>> paCs =
new ArrayList<OWLObjectConverter<? extends Parameter>>(2);
paCs.add(inputConverter);
paCs.add(outputConverter);
final OWLObjectConverter<Parameter> parameterConverter =
new CombinedOWLConverter<Parameter>(Parameter.class, paCs);
final List<OWLObjectConverter<? extends ProcessVar>> procVarCs =
new ArrayList<OWLObjectConverter<? extends ProcessVar>>(5);
procVarCs.add(parameterConverter);
procVarCs.add(localConverter);
procVarCs.add(resultVarConverter);
procVarCs.add(existentialConverter);
procVarCs.add(participantConverter);
final OWLObjectConverter<ProcessVar> processVarConverter =
new CombinedOWLConverter<ProcessVar>(ProcessVar.class, procVarCs);
final OWLObjectConverter<Expression.SPARQL> sparqlExprConverter =
InternalFactory.createExpressionConverter(Expression.SPARQL.class,
OWLS.Expression.SPARQL_Expression, OWLS.Expression.Expression, OWLS.Expression.SPARQL);
final OWLObjectConverter<Expression.SWRL> swrlExprConverter =
InternalFactory.createExpressionConverter(Expression.SWRL.class,
OWLS.Expression.SWRL_Expression, OWLS.Expression.Expression, OWLS.Expression.SWRL);
final OWLObjectConverter<Condition.SPARQL> sparqlCondConverter =
InternalFactory.createExpressionConverter(Condition.SPARQL.class,
OWLS.Expression.SPARQL_Condition, OWLS.Expression.Condition, OWLS.Expression.SPARQL);
final OWLObjectConverter<Condition.SWRL> swrlCondConverter =
InternalFactory.createExpressionConverter(Condition.SWRL.class,
OWLS.Expression.SWRL_Condition, OWLS.Expression.Condition, OWLS.Expression.SWRL);
final List<OWLObjectConverter<? extends Expression>> exprCs =
new ArrayList<OWLObjectConverter<? extends Expression>>(2);
exprCs.add(sparqlExprConverter);
exprCs.add(swrlExprConverter);
final OWLObjectConverter<Expression> expressionConverter =
new CombinedOWLConverter<Expression>(Expression.class, exprCs);
final List<OWLObjectConverter<? extends QuotedExpression>> quotedExprCs =
new ArrayList<OWLObjectConverter<? extends QuotedExpression>>(2);
quotedExprCs.add(sparqlExprConverter);
final OWLObjectConverter<QuotedExpression> quotedExpressionConverter =
new CombinedOWLConverter<QuotedExpression>(QuotedExpression.class, quotedExprCs);
final List<OWLObjectConverter<? extends Condition>> condCs =
new ArrayList<OWLObjectConverter<? extends Condition>>(2);
condCs.add(sparqlCondConverter);
condCs.add(swrlCondConverter);
final OWLObjectConverter<Condition> conditionConverter =
new CombinedOWLConverter<Condition>(Condition.class, condCs);
final GenericOWLConverter<VariableBinding> variableBindingConverter =
new GenericOWLConverter<VariableBinding>(VariableBindingImpl.class, OWLS.Expression.VariableBinding);
final OWLObjectConverter<AsProcess> asProcessConverter =
new GenericOWLConverter<AsProcess>(AsProcessImpl.class, OWLS.Process.AsProcess);
final OWLObjectConverter<Perform> performConverter =
new GenericOWLConverter<Perform>(PerformImpl.class, OWLS.Process.Perform);
final OWLObjectConverter<Sequence> sequenceConverter =
new GenericOWLConverter<Sequence>(SequenceImpl.class, OWLS.Process.Sequence);
final OWLObjectConverter<Choice> choiceConverter =
new GenericOWLConverter<Choice>(ChoiceImpl.class, OWLS.Process.Choice);
final OWLObjectConverter<AnyOrder> anyOrderConverter =
new GenericOWLConverter<AnyOrder>(AnyOrderImpl.class, OWLS.Process.AnyOrder);
final OWLObjectConverter<IfThenElse> ifThenElseConverter =
new GenericOWLConverter<IfThenElse>(IfThenElseImpl.class, OWLS.Process.IfThenElse);
final OWLObjectConverter<RepeatWhile> repeatWhileConverter =
new GenericOWLConverter<RepeatWhile>(RepeatWhileImpl.class, OWLS.Process.RepeatWhile);
final OWLObjectConverter<RepeatUntil> repeatUntilConverter =
new GenericOWLConverter<RepeatUntil>(RepeatUntilImpl.class, OWLS.Process.RepeatUntil);
final OWLObjectConverter<ForEach> forEachConverter =
new GenericOWLConverter<ForEach>(ForEachImpl.class, OWLS.Process.ForEach);
final OWLObjectConverter<Set> setConverter =
new GenericOWLConverter<Set>(SetImpl.class, OWLS.Process.Set);
final OWLObjectConverter<Split> splitConverter =
new GenericOWLConverter<Split>(SplitImpl.class, OWLS.Process.Split);
final OWLObjectConverter<SplitJoin> splitJoinConverter =
new GenericOWLConverter<SplitJoin>(SplitJoinImpl.class, OWLS.Process.SplitJoin);
final OWLObjectConverter<Produce> produceConverter =
new GenericOWLConverter<Produce>(ProduceImpl.class, OWLS.Process.Produce);
final List<OWLObjectConverter<? extends Iterate>> itCs =
new ArrayList<OWLObjectConverter<? extends Iterate>>(3);
itCs.add(repeatWhileConverter);
itCs.add(repeatUntilConverter);
itCs.add(forEachConverter);
final OWLObjectConverter<Iterate> iterateConverter = new CombinedOWLConverter<Iterate>(Iterate.class, itCs);
final List<OWLObjectConverter<? extends ControlConstruct>> ccCs =
new ArrayList<OWLObjectConverter<? extends ControlConstruct>>(13);
ccCs.add(performConverter);
ccCs.add(sequenceConverter);
ccCs.add(choiceConverter);
ccCs.add(anyOrderConverter);
ccCs.add(ifThenElseConverter);
ccCs.add(repeatWhileConverter);
ccCs.add(repeatUntilConverter);
ccCs.add(forEachConverter);
ccCs.add(setConverter);
ccCs.add(splitConverter);
ccCs.add(splitJoinConverter);
ccCs.add(produceConverter);
ccCs.add(asProcessConverter);
final OWLObjectConverter<ControlConstruct> controlConstructConverter =
new CombinedOWLConverter<ControlConstruct>(ControlConstruct.class, ccCs);
final ListConverter<OWLIndividual> objListConverter = new ListConverter<OWLIndividual>(OWLS.ObjectList.List);
final ListConverter<OWLValue> listConverter = new ListConverter<OWLValue>(RDF.ListVocabulary);
final ListConverter<ControlConstruct> ccListConverter = new ListConverter<ControlConstruct>(OWLS.Process.CCList);
final ListConverter<ControlConstruct> ccBagConverter = new ListConverter<ControlConstruct>(OWLS.Process.CCBag);
final OWLObjectConverter<InputBinding> inputBindingConverter =
new GenericOWLConverter<InputBinding>(InputBindingImpl.class, OWLS.Process.InputBinding);
final OWLObjectConverter<LinkBinding> linkBindingConverter =
new GenericOWLConverter<LinkBinding>(LinkBindingImpl.class, OWLS.Process.LinkBinding);
final OWLObjectConverter<LocBinding> locBindingConverter =
new GenericOWLConverter<LocBinding>(LocBindingImpl.class, OWLS.Process.LocBinding);
final OWLObjectConverter<OutputBinding> outputBindingConverter =
new GenericOWLConverter<OutputBinding>(OutputBindingImpl.class, OWLS.Process.OutputBinding);
final List<OWLObjectConverter<? extends Binding>> biCs =
new ArrayList<OWLObjectConverter<? extends Binding>>(4);
biCs.add(inputBindingConverter);
biCs.add(outputBindingConverter);
biCs.add(locBindingConverter);
biCs.add(linkBindingConverter);
final OWLObjectConverter<Binding> bindingConverter = new CombinedOWLConverter<Binding>(Binding.class, biCs);
final OWLObjectConverter<Result> resultConverter =
new GenericOWLConverter<Result>(ResultImpl.class, OWLS.Process.Result);
final OWLObjectConverter<ValueOf> valueOfConverter =
new GenericOWLConverter<ValueOf>(ValueOfImpl.class, OWLS.Process.ValueOf);
registry.registerConverter(Service.class, serviceConverter);
registry.registerConverter(Profile.class, profileConverter);
registry.registerConverter(ServiceParameter.class, serviceParamConverter);
registry.registerConverter(ServiceCategory.class, serviceCategoryConverter);
registry.registerConverter(Actor.class, actorConverter);
registry.registerConverter(AtomicProcess.class, atomicProcessConverter);
registry.registerConverter(CompositeProcess.class, compositeProcessConverter);
registry.registerConverter(SimpleProcess.class, simpleProcessConverter);
registry.extendByConverter(Process.class, processConverter);
registry.registerConverter(AsProcess.class, asProcessConverter);
registry.registerConverter(Perform.class, performConverter);
registry.registerConverter(Sequence.class, sequenceConverter);
registry.registerConverter(Choice.class, choiceConverter);
registry.registerConverter(AnyOrder.class, anyOrderConverter);
registry.registerConverter(IfThenElse.class, ifThenElseConverter);
registry.registerConverter(Iterate.class, iterateConverter);
registry.registerConverter(RepeatWhile.class, repeatWhileConverter);
registry.registerConverter(RepeatUntil.class, repeatUntilConverter);
registry.registerConverter(ForEach.class, forEachConverter);
registry.registerConverter(Set.class, setConverter);
registry.registerConverter(Split.class, splitConverter);
registry.registerConverter(SplitJoin.class, splitJoinConverter);
registry.registerConverter(Produce.class, produceConverter);
registry.registerConverter(ControlConstruct.class, controlConstructConverter);
registry.registerConverter(Existential.class, existentialConverter);
registry.registerConverter(Input.class, inputConverter);
registry.registerConverter(Link.class, linkConverter);
registry.registerConverter(Loc.class, locConverter);
registry.registerConverter(Output.class, outputConverter);
registry.registerConverter(Participant.class, participantConverter);
registry.registerConverter(ResultVar.class, resultVarConverter);
registry.registerConverter(Local.class, localConverter);
registry.registerConverter(Parameter.class, parameterConverter);
registry.registerConverter(ProcessVar.class, processVarConverter);
registry.registerConverter(InputBinding.class, inputBindingConverter);
registry.registerConverter(OutputBinding.class, outputBindingConverter);
registry.registerConverter(LinkBinding.class, linkBindingConverter);
registry.registerConverter(LocBinding.class, locBindingConverter);
registry.registerConverter(Binding.class, bindingConverter);
registry.registerConverter(Result.class, resultConverter);
registry.registerConverter(ValueOf.class, valueOfConverter);
registry.registerListConverter(OWLS.ObjectList.List, objListConverter);
registry.registerListConverter(RDF.ListVocabulary, listConverter);
registry.registerListConverter(OWLS.Process.CCList, ccListConverter);
registry.registerListConverter(OWLS.Process.CCBag, ccBagConverter);
registry.registerConverter(Expression.SPARQL.class, sparqlExprConverter);
registry.registerConverter(Expression.SWRL.class, swrlExprConverter);
registry.registerConverter(Condition.SPARQL.class, sparqlCondConverter);
registry.registerConverter(Condition.SWRL.class, swrlCondConverter);
registry.extendByConverter(Condition.class, conditionConverter);
registry.extendByConverter(Expression.class, expressionConverter);
registry.extendByConverter(QuotedExpression.class, quotedExpressionConverter);
registry.registerConverter(VariableBinding.class, variableBindingConverter);
} }
这里我有java.lang.ExceptionInInitializerError异常:
final OWLObjectConverter<ServiceParameter> serviceParamConverter =
new GenericOWLConverter<ServiceParameter>(ServiceParameterImpl.class, OWLS.ServiceParameter.ServiceParameter);
有关例外的其他信息:
引起:java.lang.RuntimeException:致命:无法加载OWL 本体文件 http://www.daml.org/services/owl-s/1.2/ServiceParameter.owl#!细节: java.io.IOException:无法读取本体。细节: com.hp.hpl.jena.shared.DoesNotExistException: http://www.daml.org/services/owl-s/1.2/ServiceParameter.owl
问题在于:
public static abstract class ServiceParameter
{
public static final OWLClass ServiceParameter;
public static final OWLObjectProperty serviceParameter;
public static final OWLDataProperty serviceParameterName;
public static final OWLObjectProperty sParameter;
static
{
final OWLOntology ont = loadOntology(SERVICE_PARAMETER_NS);
ServiceParameter = ont.getClass(URIUtils.createURI(SERVICE_PARAMETER_NS + "ServiceParameter"));
serviceParameter = ont.getObjectProperty(URIUtils.createURI(SERVICE_PARAMETER_NS + "serviceParameter"));
serviceParameterName = ont.getDataProperty(URIUtils.createURI(SERVICE_PARAMETER_NS + "serviceParameterName"));
sParameter = ont.getObjectProperty(URIUtils.createURI(SERVICE_PARAMETER_NS + "sParameter"));
}
最终OWLOntology ont = loadOntology(SERVICE_PARAMETER_NS);
除了这个例外之外的这种方法!
protected static OWLOntology loadOntology(final String ontologyURL, final String local)
{
logger.info("Loading ontology {} ...", ontologyURL);
URI uri = URIUtils.standardURI(ontologyURL);
OWLOntology loadedOnt;
try
{
loadedOnt = kb.read(uri);
loadedOnt.setReadOnly(true);
return loadedOnt;
}
catch (final IOException ioe)
{
String details = ioe.toString();
if (local != null)
{
InputStream in = ClassLoader.getSystemResourceAsStream(local);
try
{
loadedOnt = kb.read(in, uri);
loadedOnt.setReadOnly(true);
return loadedOnt;
}
catch (IOException iioe)
{
details += ", " + iioe.toString();
}
finally
{
if (in != null) try
{
in.close();
}
catch (IOException ignore)
{
// fall through, we can not recover anyway
}
}
}
throw new RuntimeException(
"Fatal: Failed to load OWL ontology file " + ontologyURL + "! Details: " + details);
}
}
答案 0 :(得分:2)
尝试用这个版本替换丢失的URL - 看起来它对我来说是同一个文件。
http://www.ai.sri.com/daml/services/owl-s/1.2/ServiceParameter.owl
根据我所知的OWL-S,它在过去几年中几乎没有变化,因此任何一个位置都应该有效。
答案 1 :(得分:1)
您的图书馆/程序尝试从互联网(http://www.daml.org/services/owl-s/1.2/ServiceParameter.owl)加载某个文件,但此文件不存在。这可能是一个可配置的URL(ifso,它应配置为指向正确的位置)。
此外:存在无法访问文件的回退场景,在这种情况下,它使用本地文件(由local
loadOntology
的{{1}}字符串参数指向。通过这种方式,可以使用.owl文件的本地副本,以确保即使没有互联网连接,程序也能正常运行。不幸的是,这条路线也不成功:最好的办法是确保你的软件包副本包含ServiceParameter.owl文件,并确保该文件的位置与原始软件包中的相同。