使用Atmosphere + Jersey的pubsub示例出现错误 [英] Getting error on pubsub example using Atmosphere + Jersey

查看:188
本文介绍了使用Atmosphere + Jersey的pubsub示例出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里关注本教程 http://jfarcand.wordpress.com/2011/06/29/rest-websocket-applications-为什么不使用大气框架/

I'm following the tutorial here http://jfarcand.wordpress.com/2011/06/29/rest-websocket-applications-why-not-using-the-atmosphere-framework/

我已经使用JBoss 7建立了一个Jersey项目并可以正常运行,并且工作正常.我的区别是我在Spring中使用Jersey.所以我的JQueryPubSub看起来像这样

I already have a Jersey project up and running and working fine using JBoss 7. The one difference i have is that i am using Jersey with Spring. So my JQueryPubSub looks like this

@Service  <-- For Spring component Scan
@Path("/pubsub/{topic}")
@Produces("text/html;charset=ISO-8859-1")
public class JQueryPubSub {

@PathParam("topic")
Broadcaster topic;

@GET
public SuspendResponse<String> subscribe() {
    return new SuspendResponse.SuspendResponseBuilder<String>()
            .broadcaster(topic)
            .outputComments(true)
            .addListener(new EventsLogger())
            .build();
}

@POST
@Broadcast
public Broadcastable publish(@FormParam("message") String message) {
    return new Broadcastable(message, "", topic);
}
}

所以我想添加这个示例,但是我得到了

So i wanted to add this example but i'm getting

22:55:27,381严重[com.sun.jersey.spi.inject.Errors](MSC服务线程1-3)资源已检测到以下错误和警告 和/或提供程序类: 严重:缺少以下字段的依赖项:org.atmosphere.cpr.Broadcaster com.order.resources.JQueryPubSub.topic

22:55:27,381 SEVERE [com.sun.jersey.spi.inject.Errors] (MSC service thread 1-3) The following errors and warnings have been detected with resource and/or provider classes: SEVERE: Missing dependency for field: org.atmosphere.cpr.Broadcaster com.order.resources.JQueryPubSub.topic

有什么想法可以解决这个问题,为什么泽西岛似乎正在积极地将价值注入广播公司?

Any ideas how i can fix this issue and why Jersey seems to be aggressively injecting the value into broadcaster??

推荐答案

我遇到了同样的问题,并且能够通过将球衣罐从1.4升级到1.6来解决此问题 如果使用maven,则可以添加以下依赖项.

I had the same problem and was able to fix it by updating jersey jars from 1.4 to 1.6 If you use maven, you can add the following dependencies.

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.6</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>1.6</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>1.6</version>
    </dependency>

这篇关于使用Atmosphere + Jersey的pubsub示例出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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