Jade Agents中的NoClassDefFoundError?

时间:2012-06-01 03:45:07

标签: java exception ontology agents-jade

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

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

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

1 个答案:

答案 0 :(得分: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 Reflection。