2013-02-12 52 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> 
相关问题