0

I tried to do the notify example of primefaces push in wildfly 9.0.2 but does not work, I searched the error but the answers I've found not helped me, here is my code:

and thanks for the advice

index:

<h:head>
    <title>Facelet Title</title>
</h:head>
<h:body>
    <p:growl widgetVar="growl" showDetail="true" />

    <h:form>
        <h:panelGrid columns="2">
            <p:outputLabel for="summary" value="Summary: " /> 
            <p:inputText id="summary" value="#{notifyView.summary}" required="true" />

            <p:outputLabel for="detail" value="Detail: " /> 
            <p:inputText id="detail" value="#{notifyView.detail}" required="true" />
        </h:panelGrid>

        <p:commandButton value="Send" actionListener="#{notifyView.send}" />
    </h:form>

    <p:socket onMessage="handleMessage" channel="/notify" />

    <script type="text/javascript">
        function handleMessage(facesmessage) {
            facesmessage.severity = 'info';

            PF('growl').show([facesmessage]);
        }
    </script>
</h:body>

NotifyView.java:

public class NotifyView {

private final static String CHANNEL = "/notify";

private String summary;

private String detail;

public String getSummary() {
    return summary;
}
public void setSummary(String summary) {
    this.summary = summary;
}

public String getDetail() {
    return detail;
}
public void setDetail(String detail) {
    this.detail = detail;
}

public void send() {
    EventBus eventBus = EventBusFactory.getDefault().eventBus();
    eventBus.publish(CHANNEL, new FacesMessage(StringEscapeUtils.escapeHtml3(summary), StringEscapeUtils.escapeHtml3(detail)));
}}

NotifyResource.java:

@PushEndpoint("/notify")

public class NotifyResource {

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

}

And finally web.xml:

<servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

I use Wildfly 9.0.2, Primefaces 5.2, commons-lang3-3.4 and try with atmosphere-runtime versions: 2.1.7, 2.4.0-RC6 and 2.4.5

The log error:

14:31:29,771 ERROR [io.undertow.request] (default task-24) UT005023: Exception handling request to /Primefaces2_1/primepush/notify: java.lang.NoSuchMethodError: org.atmosphere.cpr.AtmosphereServlet.configureFramework(Ljavax/servlet/ServletConfig;Z)Lorg/atmosphere/cpr/AtmosphereServlet; at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:67) at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:36) at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:80)...

mf8951
  • 23
  • 7
  • and you read them? It was the first thing I did, if you will not bring just do not say anything, you must understand that there are people who are new to a topic, especially if you belong to this community – mf8951 Aug 24 '16 at 20:39
  • Well, I didn't want it to be an offense, just to be sure. Probably you've checked them, but there's lot of people who asks questions without making any research. Anyway, going to the spot, docs for your PF version say you should utilize version 2.3.RC6 of the atmosphere runtime, which you seem not to have tested with. They also say it should work with newer versions, as 2.4, which should make a minor change, but could break the compatibility (a bit strange, by the way). However I would definitely give a try to 2.3.RC6, since the trace points to a version mismatch after all. – Aritz Aug 24 '16 at 20:52
  • I apologize for exalt but it seemed like a simplistic answer to my question and so I felt alluded. Regarding the atmosphere-runtime 2.3 RC6 I get the same error. Another question would be: Atmosphere generates conflicts with wildfly ?, because I have seen that always tomcat or glassfish have any answers in the forums, but no with wildfly – mf8951 Aug 24 '16 at 21:35
  • it might be, haven't tried myself in wildly. I don't use the push functionality, but once I set it up in tomcat just following the normal steps. Are you trying to set it up in a new project? Do you have any shared libraries in wildly? – Aritz Aug 25 '16 at 04:39
  • Yes I tried this in a new project, then pass it to the project in which I work. Apparently it has to do with the use of wildfly, I tried the same with glassfish and it works, In glassfish works with atmosphere-runtime 2.1.7, and commons-lang3-3.1. Well, I keep trying – mf8951 Aug 26 '16 at 13:27

1 Answers1

0

Finally I found a solution:

Using atmosphere-runtime-native and jboss-as-websockets libraries works.

thanks for help to Xtreme Biker

mf8951
  • 23
  • 7