Primepush not works on Wildfly 8

UI Components for JSF
suikast42
Posts: 17
Joined: 03 Jul 2012, 08:41

28 Mar 2014, 16:31

Hi guys,

I extract my problem to a little war project on github. https://github.com/suikast42/websockettest.

If I push a message on a channel I get the wraning shown below.
WARN [org.atmosphere.cpr.MetaBroadcaster] (EJB default - 2) No Broadcaster matches /testchannel. Message {"data":""} WILL BE LOST. Make sure you cache it or make sure the Broadcaster exists before.

And my site is not up to date after the event. As the warning says. It losts.

My Runtime:

PF 4.0.10
Atmosphere 2.1.1
Wildfly 8.0.0.Final

suikast42
Posts: 17
Joined: 03 Jul 2012, 08:41

28 Mar 2014, 17:20

If I switch from then its works partial

...
<init-param>
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useNative</param-name>
<param-value>false</param-value>
</init-param>
...

to
<init-param>
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useNative</param-name>
<param-value>true</param-value>
</init-param>

I thought that the webserver undertow from wildfly 8 supports websockets ?? I'm wrong??

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

28 Mar 2014, 18:18

I have it working without any of those init params... What version of PF(push) are you using and what version of atmosphere? And what is your pom? (things you should normally report in your initial post ;-))

I use PF push 2.0/PF 5.0

web.xml

Code: Select all

        <context-param>
                <param-name>primefaces.PUSH_SERVER_URL</param-name>
                <param-value>http://127.0.0.1:8080</param-value>
        </context-param>

        <servlet>
                <servlet-name>Push Servlet</servlet-name>
                <servlet-class>org.primefaces.push.PushServlet</servlet-class>
                <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>
pom.xml

Code: Select all

		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>5.0-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>org.atmosphere</groupId>
			<artifactId>atmosphere-runtime</artifactId>
			<version>2.1.0</version>
		</dependency>
		<dependency>

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

29 Mar 2014, 05:17

+1 Ronald; that's good to know and thanks for sharing.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

suikast42
Posts: 17
Joined: 03 Jul 2012, 08:41

31 Mar 2014, 12:26

kukeltje wrote:I have it working without any of those init params... What version of PF(push) are you using and what version of atmosphere? And what is your pom? (things you should normally report in your initial post ;-))
Look at the bottom of my post. There're a list of the versions.

First of all. The snapshot solution is not acceptable. I can't shipp a snapshot lib in the production envivornment.

The second think is I can't test this because I can't find the 5-0.SNAPSHOT in the maven repo. Did you build this from the showcase sources?

I try a strange thing.

I change the pushchannel from /testchannel to /*. That's works as excpected. Biut this can't be a solution :-D.

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

31 Mar 2014, 12:30

suikast42 wrote:I change the pushchannel from /testchannel to /*. That's works as excpected. Biut this can't be a solution :-D.
+1 (yes, it is the solution). :)
Last edited by smithh032772 on 06 Apr 2014, 13:31, edited 2 times in total.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

suikast42
Posts: 17
Joined: 03 Jul 2012, 08:41

31 Mar 2014, 14:58

smithh032772 wrote:
suikast42 wrote:I change the pushchannel from /testchannel to /*. That's works as excpected. Biut this can't be a solution :-D.
+1
What should that be +1 ??

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

31 Mar 2014, 17:25

suikast42 wrote:What should that be +1 ??
what is google +1
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

02 Apr 2014, 18:20

suikast42 wrote:Look at the bottom of my post. There're a list of the versions.
Sorry, I must have clearly missed that
suikast42 wrote: First of all. The snapshot solution is not acceptable. I can't shipp a snapshot lib in the production envivornment.
Well, what is better? A working snapshot or a non-working 'release'... Oh did you upgrade to 4.0.11 already? Hope you are not relying on datatable dbclick select events ;-). What I mean is, when is something production quality? For me it is always: if it works, it works...
suikast42 wrote: The second think is I can't test this because I can't find the 5-0.SNAPSHOT in the maven repo. Did you build this from the showcase sources?
Yes
suikast42 wrote:
I try a strange thing.

I change the pushchannel from /testchannel to /*. That's works as excpected. Biut this can't be a solution :-D.
Are you sure

Code: Select all

<p:socket id="socket" channel="#{pushEventBroker.channelTest}"...
is evaluated correctly?

Will try to check later tonight if I find the time

suikast42
Posts: 17
Joined: 03 Jul 2012, 08:41

03 Apr 2014, 13:14

The base of the problem was that I fired events in postconstruct of the sessionscoped bean. It seems so that atmosphere's broadcaster is not ready at this moment.

If I wait for fire events then it works as expected.

Code: Select all

        Broadcaster lookup = BroadcasterFactory.getDefault().lookup(channelID);
        if (lookup == null) {
             // Maybe broadcaster not ready wait for a second
           new Thread(new Runnable() {
               @Override
               public void run() {
                   try {
                       logger.warn("Atmosphere not ready wait");
                       Thread.sleep(1000);
                   } catch (InterruptedException e) {
                   }
                   logger.warn("Fire delayed push");
                   pushContext.push(channelID, obj);
               }
           }).start();
        } else {
            logger.warn("Fire push");
            pushContext.push(channelID, obj);
        }

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests