0

我创建了两个代理,它运行良好。但是当我添加本体类并注册本体时,我无法创建代理......我得到了以下错误..

Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
Jun 1, 2012 8:56:55 AM jade.core.messaging.MessagingService clearCachedSlice
INFO: Clearing cache
Jun 1, 2012 8:56:55 AM jade.mtp.http.HTTPServer <init>
INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Jun 1, 2012 8:56:55 AM jade.core.messaging.MessagingService boot
INFO: MTP addresses:
http://169.254.108.164:7778/acc
Jun 1, 2012 8:56:55 AM jade.core.AgentContainerImpl startBootstrapAgents
SEVERE: Cannot create agent STMAgent: An undeclared exception was thrown [nested   java.lang.ExceptionInInitializerError]
Jun 1, 2012 8:56:55 AM jade.core.AgentContainerImpl startBootstrapAgents
SEVERE: Cannot create agent REquestAgent: An undeclared exception was thrown [nested java.lang.NoClassDefFoundError: Could not initialize class FruitOntology.FruitOntology]
Jun 1, 2012 8:56:55 AM jade.core.AgentContainerImpl joinPlatform

类路径是正确的。本体类路径也是正确的。这是什么原因?请帮助我............我发现了错误......它在我的本体课上......谢谢......

4

1 回答 1

1

关键的错误信息似乎是:

SEVERE: Cannot create agent REquestAgent: An undeclared exception was thrown 
  [nested java.lang.NoClassDefFoundError: 
   Could not initialize class FruitOntology.FruitOntology]

您的代码没有FruitOntology在包中找到类FruitOntology(这不是一个很好的包名称 - 通常,包名称以小写字母开头,并且通常遵循反转组织域名的约定)。

由于您没有显示任何代码,我们只能猜测为什么会出现该错误。您是否在某个配置文件中拼错了名称?通过您的项目执行 grep 以查看FruitOntology.FruitOntology发生的位置。它可能不在普通的 Java 代码中,因为您会因为缺少类而收到编译错误,除非您出于某种原因使用 Java 反射。

于 2012-06-01T19:26:39.477 回答