2016-10-05 8 views
0

プライムフェイス5.3、jsf 2.1、雰囲気ランタイム2.3.0、スプリング4.0.0、サーブレット3.0を使用するアプリケーションがあります。eventBus()メソッドがnullを返しています

EventBus eventBus = EventBusFactory.getDefault().eventBus(); 

それは常にnullを返し、私はいくつかのページで検索が、私の問題を解決することはできません、

これは私のweb.xmlで

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 
    <display-name>Aclaraciones</display-name> 

    <welcome-file-list> 
     <welcome-file>login.xhtml</welcome-file> 
    </welcome-file-list> 

    <servlet> 
     <servlet-name>Faces Servlet</servlet-name> 
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>Faces Servlet</servlet-name> 
     <url-pattern>*.xhtml</url-pattern> 
    </servlet-mapping> 

    <context-param> 
     <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> 
     <param-name>javax.faces.STATE_SAVING_METHOD</param-name> 
     <param-value>server</param-value> 
    </context-param> 

    <context-param> 
     <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> 
     <param-value>resources.application</param-value> 
    </context-param> 

    <listener> 
     <listener-class>com.sun.faces.config.ConfigureListener</listener-class> 
    </listener> 

    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <listener> 
     <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 
    </listener> 

    <context-param> 
     <param-name>primefaces.THEME</param-name> 
     <param-value>start</param-value> 
    </context-param> 

    <context-param> 
     <param-name>primefaces.FONT_AWESOME</param-name> 
     <param-value>true</param-value> 
    </context-param> 

    <session-config> 
     <session-timeout>30</session-timeout> 
    </session-config> 

    <filter> 
     <filter-name>filtro</filter-name> 
     <filter-class>com.aclaraciones.filter.LoginFilter</filter-class> 
    </filter> 

    <filter-mapping> 
     <filter-name>filtro</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <servlet> 
     <servlet-name>Push Servlet</servlet-name> 
     <servlet-class>org.primefaces.push.PushServlet</servlet-class> 
     <init-param> 
      <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name> 
      <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value> 
     </init-param> 
     <load-on-startup>0</load-on-startup> 
     <async-supported>true</async-supported> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>Push Servlet</servlet-name> 
     <url-pattern>/primepush/*</url-pattern> 
    </servlet-mapping> 
</web-app> 

これは、エンドポイントを使用して私のクラスです。

@PushEndpoint("/notify") 
public class PushEndPoint { 

    @OnMessage(encoders = {JSONEncoder.class}) 
    public FacesMessage onMessage(FacesMessage message){ 
     return message; 
    } 

} 

そして、私は誰かが私が何をしないのです知っている

public void socket(){ 
    EventBus eventBus = EventBusFactory.getDefault().eventBus(); 
    eventBus.publish("/notify", "Hola mundo"); 
} 

この方法を実行しますか?

ありがとうございます。

答えて

0

このようなエラーが発生しました。 Atmosphere 2.4.3のバージョンを変更してみてください。 あなたがここにも

EventBusFactory JSF1073

1

私は作品のバージョンが5.2であると私は使用した雰囲気のバージョンがあることがわかった、私の問題は私が使っていたprimefacesのバージョンであることがわかった試みの後、再試行してください:

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

    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-lang3</artifactId> 
     <version>3.3.2</version> 
    </dependency> 

    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
     <version>1.6.1</version> 
    </dependency> 

    <dependency> 
     <groupId>javax.inject</groupId> 
     <artifactId>javax.inject</artifactId> 
     <version>1</version> 
    </dependency> 

これが他の人を助けることを願って

+0

見て私に聞いて喜ん:)感謝 –

+0

を助けたことができ、あなたは歓迎:)です。 –

関連する問題