2013-02-12 54 views
3

我試圖從服務器推送消息到客戶端方式:java.lang.NoClassDefFoundError:組織/大氣/ CPR/AsyncSupportListenerAdapter

PushContext pushContext = PushContextFactory.getDefault().getPushContext(); 
pushContext.push("/registrationEvent", "There was another registration"); 

我的問題是我下面的錯誤

ava.lang.NoClassDefFoundError: Could not initialize class org.primefaces.push.PushContextFactory 

但我認爲,這是由於一個問題在謨的初始化:

java.lang.NoClassDefFoundError: org/atmosphere/cpr/AsyncSupportListenerAdapter 

我已經嘗試添加jar氣氛文件...沒有成功。我做錯了什麼?我正在使用glassfish 3.1。

謝謝!

+0

您從哪裏刪除該JAR文件?你知道這不只是一個JAR文件嗎?您是否認真閱讀Push主題上的PrimeFaces *用戶指南*? – BalusC 2013-02-12 17:25:32

+0

我將jar文件添加到整個項目中。我這樣做是因爲我認爲這是我的問題的原因,根據我的最新錯誤信息。我已閱讀文檔,但沒有找到解決問題的方法......您需要告訴我哪些信息有問題? – Derbie 2013-02-12 18:07:44

+0

嗯,你已經把JAR放在項目的根目錄下了?這不是它的工作原理。它必須與PrimeFaces JAR文件'/ WEB-INF/lib'文件夾保持一致。 – BalusC 2013-02-12 19:04:55

回答

1

Primefaces MigrationGuide通知:「重新實現PrimeFaces Push,不推薦使用PushContext,而是使用EventBus以及新的Push API。」

在這種情況下,在pom.xml上,放置2.2.1大氣的版本。可能你正在使用舊版的氣氛版本。如果您嘗試使用Primefaces 5.0,請輸入以下代碼:

<dependency> 
    <groupId>org.primefaces</groupId> 
    <artifactId>primefaces</artifactId> 
    <version>5.0</version> 
</dependency> 

<dependency> 
    <groupId>org.primefaces.extensions</groupId> 
    <artifactId>primefaces-extensions</artifactId> 
    <version>2.1.0</version> 
</dependency> 

<dependency> 
    <groupId>org.atmosphere</groupId> 
    <artifactId>atmosphere-runtime</artifactId> 
    <version>2.2.1</version> 
</dependency> 
相關問題