PrimePush ClassNotFoundException [英] PrimePush ClassNotFoundException

查看:167
本文介绍了PrimePush ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图让PrimePush在运行在Tomcat 7上的Web应用程序上正常工作.我整天都在搜索线程和StackOverFlow,但还没有找到解决方案!其中一些包括

I have been trying to get PrimePush working on my web application that runs on Tomcat 7. I have spent the whole day searching threads and StackOverFlow but have not yet came across a solution! Some of these include, this and this aswell as several others! Any help would be appreciated!

我遵循了PrimeFaces用户指南来设置PrimePush.我的设置是Tomcat7,PrimeFaces 3.5,Atmosphere 1.0.0.RC1,GlassFish 2.1.17/WEB 2.2.

I followed the PrimeFaces User Guide on setting up PrimePush. My setup is Tomcat7, PrimeFaces 3.5, Atmosphere 1.0.0.RC1 , GlassFish 2.1.17 / WEB 2.2.

因此,我具有以下依赖性;

As such, I have the following dependencies;

    <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是:

My web.xml is:

<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展示柜中的Push示例.每当我尝试从托管bean推送时;

I have been attemping the Push examples from the PrimeFaces showcase. Whenever I attempt to push from my managedbean;

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

请询问是否需要更多信息/详细信息. 预先感谢.

Please ask if any more info/details are required. Thanks in advance.

推荐答案

由于我的错误,

    Caused by: java.lang.ClassNotFoundException: 
org.atmosphere.cpr.AsyncSupportListenerAdapter

并且由于我具有正确的依赖关系(根据PF手册),所以我认为它可能与我的pom.xml文件有关.由于我的设置,我包括几个导入包.因此,我添加了以下程序包

and since I had the correct dependencies (according to the PF manual), I thought it might be related to my pom.xml file. Due to my set up, I include several Import-Packages. So I added the following package,

<Import-Package>org.atmosphere.cpr</Import-Package>

这导致我的ClassNotFoundException问题得到解决,但是,在尝试部署Web应用程序时遇到了另一个问题.

This resulted in my ClassNotFoundException being resolved, however, I came across another issue when trying to deploy my 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的列表越来越大.

This confused me, according to the PF manual, I don't require any more dependencies than I have already included. So anyway, to try and resolve the issue I went about finding the correct dependency and included that. However, the list of Missing Constraint's grew larger and larger.

现在,我不想包含任何不需要且不会使用的依赖项.因此,我删除了添加的所有依赖项,但Atmosphere除外.在查看用于运行时的Maven存储库时,我注意到PF用户指南中给出的版本现在已经过时了.所以我改为使用最新的:

Now, I didn't want to include any dependencies that I don't require and will not use. So I removed all of the dependencies I added, except from Atmosphere. When looking at the maven repo for atmosphere-runtime, I noticed that the version given in the PF user guide, is now quite outdated. So I changed to use the most recent:

    <dependency>
        <groupId>org.atmosphere</groupId>
        <artifactId>atmosphere-runtime</artifactId>
        <version>2.0.1</version>
    </dependency>

宾果游戏-它现在可以成功构建和部署(尽管我在从客户端JSF页面接收推送"时遇到了麻烦-但这是另一个问题!).为什么我有这个问题,而不是其他问题,仍然使我感到困惑.但我希望这对遇到类似问题的人有所帮助.

And bingo - it now builds and deploys successfully(Though I am having trouble receiving a 'push' from my client JSF page - but that's a different question!). Why I had this issue and not others, still confuses me. But I hope this helps anyone with a similar issue.

这篇关于PrimePush ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆