首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jboss 7.1.1下的PrimePush

Jboss 7.1.1下的PrimePush
EN

Stack Overflow用户
提问于 2014-06-26 16:52:26
回答 2查看 1.4K关注 0票数 0

我正在开发一个使用PrimePush技术的反例应用程序。我使用的是Jboss 7.1.1下的Promefaces 5.0和Atmosphere 2.1.6

我发现使用Primefaces 3.4.2和atmosphere 1.0.8推送是可行的。但是我必须使用primefaces 5.0

所以我使用的是官方的Primefaces计数器示例

代码语言:javascript
复制
@ManagedBean
@ApplicationScoped
public class GlobalCounterView implements Serializable{

    private volatile int count;

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public void increment() {
        count++;

        EventBus eventBus = EventBusFactory.getDefault().eventBus();
        eventBus.publish("/counter", String.valueOf(count));
    }
}

这是我的web.xml

代码语言:javascript
复制
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
    <init-param>
        <param-name>org.atmosphere.useWebSocket</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.sessionSupport</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.useNative</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
        <param-value>org.atmosphere.cache.HeaderBroadcasterCache</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcastFilterClasses</param-name>
        <param-value>org.atmosphere.client.TrackMessageSizeFilter</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.resumeOnBroadcast</param-name>
        <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

然后,我将Jboss配置为使用高级IO

代码语言:javascript
复制
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="true">

但是,当我部署应用程序并单击count按钮时,我得到以下错误

代码语言:javascript
复制
10:31:50,019 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Installed     AtmosphereInterceptor @PushEndpoint Interceptor with priority AFTER_DEFAULT 
10:31:50,031 INFO  [org.jboss.web] (MSC service thread 1-8) JBAS018210: Registering web context:      /pushcomment
10:31:51,515 INFO  [org.atmosphere.cpr.AtmosphereFramework] (Thread-71) Latest version of Atmosphere's JavaScript Client 2.2.2
10:33:03,976 INFO  [org.hibernate.validator.util.Version] (http-localhost-127.0.0.1-8080-2) Hibernate Validator 4.2.0.Final
10:33:05,594 ERROR [org.atmosphere.container.JBossWebCometSupport] (http-localhost-127.0.0.1-8080-1) HttpEvent is null, JBoss APR Not Properly installed
10:33:05,595 WARN  [org.atmosphere.cpr.AtmosphereFramework] (http-localhost-127.0.0.1-8080-1) Failed using comet support: org.atmosphere.container.JBossWebCometSupport, error: JBoss failed to detect this is a Comet application because the APR Connector is not enabled. 
Make sure atmosphere-compat-jboss.jar is not under your WEB-INF/lib and You must use the  atmosphere- native-runtime dependency in order to use native Comet Support
there is no context.xml under WEB-INF Is the NIO or APR Connector enabled?
10:33:05,598 ERROR [org.atmosphere.cpr.AtmosphereFramework] (http-localhost-127.0.0.1-8080-1) If   you have more than one Connector enabled, make sure they both use the same protocol, e.g NIO/APR or   HTTP for all. If not, org.atmosphere.container.BlockingIOCometSupport will be used and cannot be   changed.
10:33:05,601 WARN  [org.atmosphere.cpr.AtmosphereFramework] (http-localhost-127.0.0.1-8080-1) Using org.atmosphere.container.BlockingIOCometSupport
10:33:05,603 ERROR [org.atmosphere.cpr.AsynchronousProcessor] (http-localhost-127.0.0.1-8080-1) Invalid request state. Websocket protocol not supported

我可以在此配置中使用PrimePush吗?如果不能,在jboss 7.1.1中有没有其他方法可以将数据推送到网页?

EN

回答 2

Stack Overflow用户

发布于 2014-06-27 15:08:36

我使用以下版本和配置运行此程序:

Primefaces 5.0、JBoss 7.1、Atmosphere 2.1.3

web.xml

代码语言:javascript
复制
<servlet>
    <servlet-name>PrimePushServlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
    <async-supported>true</async-supported>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
        <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>PrimePushServlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

日志文件状态

代码语言:javascript
复制
08:57:36,055 INFO  [org.atmosphere.cpr.AtmosphereFramework] (http--0.0.0.0-8080-2) Atmosphere Framework 2.1.3 started.
08:57:36,055 INFO  [org.atmosphere.cpr.AtmosphereFramework] (http--0.0.0.0-8080-2) 
For Atmosphere Framework Commercial Support, visit 
http://www.async-io.org/ or send an email to support@async-io.org
08:57:36,056 INFO  [org.atmosphere.cpr.AtmosphereFramework] (http--0.0.0.0-8080-2) Installed AtmosphereInterceptor @PushEndpoint Interceptor with priority AFTER_DEFAULT 
08:57:36,057 ERROR [org.atmosphere.container.JBossWebCometSupport] (http--0.0.0.0-8080-2) HttpEvent is null, JBoss APR Not Properly installed
08:57:36,057 WARN  [org.atmosphere.cpr.AtmosphereFramework] (http--0.0.0.0-8080-2) Failed using comet support: org.atmosphere.container.JBossWebCometSupport, error: JBoss failed to detect this is a Comet application because the APR Connector is not enabled. 
Make sure atmosphere-compat-jboss.jar is not under your WEB-INF/lib and You must use the atmosphere-native-runtime dependency in order to use native Comet Support there is no context.xml under WEB-INF Is the NIO or APR Connector enabled?

但它确实有效..。如果有人真的设法摆脱了这些消息,我将很高兴知道如何:)

票数 1
EN

Stack Overflow用户

发布于 2015-05-19 17:39:39

你是否确保你的JBoss是从使用本机库开始的?要在日志中进行验证,请尝试查找字符串org.apache.coyote.http11.Http11AprProtocol而不是org.apache.coyote.http11.Http11Protocol。如果不是这样,请参阅how to fix JBoss configuration here

此外,您还需要使用atmosphere-runtime-native库,而不是纯atmosphere-runtime

希望能对你有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24426242

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档