2012-06-01 57 views
0

我創建了兩個代理,它運行良好。但是當我添加本體類和註冊本體時,我無法創建代理...我得到以下錯誤..Jade Agents中的NoClassDefFoundError?

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

關鍵的錯誤信息似乎是:

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反射。