我一直试图让PrimePush在运行于Tomcat 7上的web应用程序上工作。我花了一整天时间搜索线程和StackOverFlow,但还没有找到解决方案!其中包括这和这以及其他几个!任何帮助都将不胜感激!
我遵循了关于设置PrimeFaces PrimePush的PrimePush用户指南。我的设置是Tomcat7,PrimeFaces 3.5,ata1.0.0.RC1,GlassFish 2.1.17 /Web2.2。
因此,我有以下的依赖项;
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>1.0.0.RC1</version>
<scope>compile</scope>
</dependency>我的web.xml是:
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>我一直在尝试PrimeFaces展示中的推送示例。每当我试图推开我的管理豆子;
PushContext p = PushContextFactory.getDefault().getPushContext();
p.push("/counter", String.valueOf(count));我得到以下错误:
org.eclipse.virgo.kernel.osgi.framework.ExtendedNoClassDefFoundError: org/atmosphere/cpr/AsyncSupportListenerAdapter in KernelBundleClassLoader: [bundle=org.primefaces_3.5.0] in KernelBundleClassLoader: [bundle=org.primefaces_3.5.0]
...
...
...
Caused by: java.lang.ClassNotFoundException: org.atmosphere.cpr.AsyncSupportListenerAdapter请询问是否需要更多的信息/细节。提前谢谢。
发布于 2013-10-04 09:16:03
所以由于我的错误,
Caused by: java.lang.ClassNotFoundException:
org.atmosphere.cpr.AsyncSupportListenerAdapter而且,由于我有正确的依赖项(根据PF手册),我认为它可能与我的pom.xml文件有关。由于我的设置,我包括了几个进口包。所以我加入了下面的包
<Import-Package>org.atmosphere.cpr</Import-Package>这导致了我的ClassNotFoundException被解决了,然而,当我试图部署我的webapp时,我遇到了另一个问题。
The bundle "atmosphere-runtime-1.0.0.RC1.jar" could not be resolved.
Reason: Missing Constraint: Import-Package: com.sun.enterprise.web.connector.grizzly.comet这让我感到困惑,根据PF手册,我不需要比我已经包含的更多的依赖项。因此,无论如何,为了解决这个问题,我开始寻找正确的依赖关系,并将其包括在内。然而,Missing Constraint的名单越来越大。
现在,我不想包含任何我不需要也不会使用的依赖项。因此,除大气外,我删除了添加的所有依赖项。当我查看maven回购的大气运行时,我注意到在PF用户指南中给出的版本现在已经非常过时了。因此,我改变了使用最近的:
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>2.0.1</version>
</dependency>bingo --它现在成功地构建和部署了(虽然我很难从我的客户端JSF页面得到一个“推送”),但这是一个不同的问题!为什么我有这个问题而不是其他问题,仍然让我感到困惑。但我希望这对任何有类似问题的人都有帮助。
https://stackoverflow.com/questions/19166402
复制相似问题