我正在尝试以这种方式将消息从服务器推送到客户端:
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。
谢谢!
最佳答案
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>
关于jsf - java.lang.NoClassDefFoundError : org/atmosphere/cpr/AsyncSupportListenerAdapter 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14835535/