0

Since Primefaces push is deprecated, i want to change to JSF 2.3 with f:websocket.

Therefore i added a websocket in my xhtml:

<h:form>
    <f:websocket channel="testChannel" onmessage="socketListener" />
    <h:outputScript>
        function socketListener(message, channel, event) {            
            console.log(message);          
        }
    </h:outputScript>
</h:form>

And i added a Bean to send Pushs:

@Named("PushTestBean")
@ApplicationScoped
public class TestPush {

    @Inject
    @Push(channel = "testChannel")
    private PushContext push;

    public void test() {
        push.send("test");
    }
}

In my web.xml i have:

<context-param>
    <param-name>javax.faces.ENABLE_WEBSOCKET_ENDPOINT</param-name>
    <param-value>true</param-value>
</context-param>

I added the jsf 2.3 jars as described to my wildfly 11.0.0 server. Compilation and deployment works without any problems. But when i navigate to the page with the socket i get an exception:

2018-02-15 22:41:48,224 ERROR [de.digitaljukebox.web.exceptionHandler.CustomExceptionHandler] (default task-96) Error while rendering view: javax.faces.application.ViewHandler.getWebsocketURL(Ljavax/faces/context/FacesContext;Ljava/lang/String;)Ljava/lang/String;
kaiser
  • 940
  • 1
  • 10
  • 25
  • Full stacktrace please – Kukeltje Mar 12 '18 at 21:13
  • There is no stack trace, single error line in log. I had a full stacktrace before in the edited question, but i that were only errors from my webfilter and pretty faces. So i deactivated them and this line was left – kaiser Mar 12 '18 at 21:19
  • Can this be a wrong or corrupt jsf2.3 implementation? – kaiser Mar 12 '18 at 21:23
  • No idea. Did not use JSF 2.3 yet. Maybe I'll try the coming days. – Kukeltje Mar 12 '18 at 21:29
  • 1
    Big chance "I added the jsf 2.3 jars as described to my wildfly 11.0.0 server" step was done wrong. It at least works for me when following the instructions on https://stackoverflow.com/q/35899887 (and having NO Java EE/JSF libraries bundled in webapp). – BalusC Mar 12 '18 at 22:07
  • Yeah maybe, i'll give it a try. Thx – kaiser Mar 12 '18 at 22:25
  • I have a similar problem using WildFly 12 using JSF 2.3. I have the EJB 'fireEvent' to my POJO and the '@Observes' method is executed. However the 'push.send' doesn't appear to communicate with my XHTML. Have you progressed this any further? – NOTiFY Apr 18 '18 at 14:18
  • Any feedback? Did you succeed? – Kukeltje May 15 '18 at 08:31
  • I needed to go life with the project, so i decided to stay on the primefaces push. But i'm 99% sure, that i had a wrong installation of jsf 2.3 on my wildfly... I will wait, until wildfly adds them. – kaiser May 17 '18 at 22:50

0 Answers0