You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Felipe Jaekel <fk...@gmail.com> on 2014/09/03 21:16:06 UTC

Does anyone uses atmosphere-runtime in production?

Hi,

Does anyone uses atmosphere-runtime in production with TomEE plus 1.7.0? I
had some problems when I tried it in a regular Tomcat 7 some time ago.

Thanks

Re: Does anyone uses atmosphere-runtime in production?

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Fri, Sep 5, 2014 at 3:05 PM, Felipe Jaekel <fk...@gmail.com> wrote:

> I thought so too, but it doesn't. From what I read today in the atmosphere
> group, the native runtime is only required for "old" non-standard
> websockets implementations, so I'll give atmosphere-runtime another try.
>

okay/interesting.


>
> I think the server crash happened because the PrimeFaces socket
> component doesn't validates the user browser, and I had a lot of clients
> with
> old IE. Currently I only render the socket component with the client
> browser supports websocket.
>

okay/interesting.


>
> Could you share your PrimeFaces socket component configuration?
>

        <h:outputScript library="primefaces" name="push/push.js"
target="head" />
        <p:growl id="pushedNotifications" for="socketForNotifications"
                 widgetVar="growl" globalOnly="false"
                 life="30000" showDetail="true" showSummary="true"
escape="false"/>
        <p:socket id="socketForNotifications"
onMessage="handlePushedMessage"
                  widgetVar="socket"
                  channel="/#{pf_usersController.userPushChannelId}" />


userPushChannelId = sessionId (see code below)

        FacesContext facesContext = FacesContext.getCurrentInstance();
        HttpSession httpSession = (HttpSession)
facesContext.getExternalContext().getSession(false);
        String sessionId;
        if (httpSession != null) {
            sessionId = user.getUserName() + httpSession.getId();
        }
        else {
            sessionId = user.getUserName() +
                        new
DateTime(user.getLastLoginDt()).toString("yyyyMMddhhmmssa");
        }
        logger.info("sessionId = " + sessionId);


NotifyResource.java (as required by PrimeFaces 5.0 Push, and sample code
provided by PrimeFaces Push - Notify example in showcase and user guide)

package pf;

import javax.faces.application.FacesMessage;
import org.primefaces.push.annotation.OnMessage;
import org.primefaces.push.annotation.PushEndpoint;
import org.primefaces.push.annotation.Singleton;
import org.primefaces.push.impl.JSONEncoder;

@PushEndpoint("/{usernameAndSessionId}")
@Singleton
public class NotifyResource {

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

}


again, my web.xml is as follows:


    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>

<param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>

<param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>


FYI, my webapp only targets Google Chrome browser on Windows desktops, iPad
and Android devices.

Re: Does anyone uses atmosphere-runtime in production?

Posted by Felipe Jaekel <fk...@gmail.com>.
>
> hmmm, what do you mean, when you say that it was impossible to use the
> server? server == tomcat7 or tomee 1.x?
>

tomcat 7, I haven't started using tomee in production yet


> what do you mean when you say, removing the application with it from the
> server immediately solved the problem?
>

undeploying the war that had atmosphere-runtime


> application = WAR that includes primefaces + atmosphere-runtime JAR ?
>

yes

i think you were running atmosphere-runtime-native and primefaces 4 with
> tomcat7 (and not tomee 1.x), right?
>

yes


> i would assume that primefaces 5 + atmosphere-runtime-native will work,
> if/since primefaces 4 + atmosphere-runtime-native + your server/app config.
>

I thought so too, but it doesn't. From what I read today in the atmosphere
group, the native runtime is only required for "old" non-standard
websockets implementations, so I'll give atmosphere-runtime another try.

I think the server crash happened because the PrimeFaces socket component
doesn't validates the user browser, and I had a lot of clients with
old IE. Currently
I only render the socket component with the client browser supports
websocket.

Could you share your PrimeFaces socket component configuration?

Thanks

Re: Does anyone uses atmosphere-runtime in production?

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
see my responses inline, below.


On Thu, Sep 4, 2014 at 12:59 PM, Felipe Jaekel <fk...@gmail.com> wrote:

> Tomcat 7 was throwing illegal state exceptions everywhere, even in the
> manager application, so it was impossible to use the server. In that case
> atmosphere-runtime.jar was packed in WEB-INF/lib, and removing the
> application with it from the server immediately solved the problem.
>

hmmm, what do you mean, when you say that it was impossible to use the
server? server == tomcat7 or tomee 1.x?

what do you mean when you say, removing the application with it from the
server immediately solved the problem?

application = WAR that includes primefaces + atmosphere-runtime JAR ?

server = tomcat7 or tomee 1.x ?


>
> With atmosphere-runtime-native I didn't have this issue, but now I want to
> migrate my applications from PrimeFaces 4 to 5 and it doesn't works with
> atmosphere-runtime-native.
>

i think you were running atmosphere-runtime-native and primefaces 4 with
tomcat7 (and not tomee 1.x), right?


>
> I remember you helped me in PrimeFaces and Atmosphere forum. Since I still
> haven't found a solution for PrimeFaces 5 + atmosphere-runtime-native, I'm
> thinking about trying atmosphere-runtime again, but as the issue I
> mentioned only happens in production, I'd like to see first if anyone else
> is using it successfully.
>

i would assume that primefaces 5 + atmosphere-runtime-native will work,
if/since primefaces 4 + atmosphere-runtime-native + your server/app config.

i have been using primefaces 4 and 5 + atmosphere-runtime JAR + tomee
1.5.1, 1.6.x, and 1.7.0. I include atmosphere-runtime JAR in my WAR file,
and I do not use atmosphere-compat JARs, and I use websocket instead of
COMET.


>
> Can you share your connector configuration from server.xml? Currently I'm
> using this:
>
> <Connector
>
> compressableMimeType="text/html,text/xml,text/css,text/javascript,application/x-javascript,application/javascript"
>  compression="on"
> connectionTimeout="20000"
> port="8080"
>  protocol="org.apache.coyote.http11.Http11NioProtocol"
> redirectPort="8443" />
>
>
below, is my <connector> in server.xml,

    <Connector port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" connectionTimeout="20000"
acceptorThreadCount="2"
               redirectPort="8443" socket.directBuffer="false"/>


and my web.xml has the following:


    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>

<param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>

<param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>



> Thanks
>
>
> 2014-09-03 16:59 GMT-03:00 Howard W. Smith, Jr. <sm...@gmail.com>:
>
> > I use it, since I am using PrimeFaces Push in my web app.
> >
> > what problems are you having? how are you deploying and/or packaging
> > atmosphere-runtime?
> >
> >
> >
> > On Wed, Sep 3, 2014 at 3:16 PM, Felipe Jaekel <fk...@gmail.com>
> wrote:
> >
> > > Hi,
> > >
> > > Does anyone uses atmosphere-runtime in production with TomEE plus
> 1.7.0?
> > I
> > > had some problems when I tried it in a regular Tomcat 7 some time ago.
> > >
> > > Thanks
> > >
> >
>

Re: Does anyone uses atmosphere-runtime in production?

Posted by Felipe Jaekel <fk...@gmail.com>.
Tomcat 7 was throwing illegal state exceptions everywhere, even in the
manager application, so it was impossible to use the server. In that case
atmosphere-runtime.jar was packed in WEB-INF/lib, and removing the
application with it from the server immediately solved the problem.

With atmosphere-runtime-native I didn't have this issue, but now I want to
migrate my applications from PrimeFaces 4 to 5 and it doesn't works with
atmosphere-runtime-native.

I remember you helped me in PrimeFaces and Atmosphere forum. Since I still
haven't found a solution for PrimeFaces 5 + atmosphere-runtime-native, I'm
thinking about trying atmosphere-runtime again, but as the issue I
mentioned only happens in production, I'd like to see first if anyone else
is using it successfully.

Can you share your connector configuration from server.xml? Currently I'm
using this:

<Connector
compressableMimeType="text/html,text/xml,text/css,text/javascript,application/x-javascript,application/javascript"
 compression="on"
connectionTimeout="20000"
port="8080"
 protocol="org.apache.coyote.http11.Http11NioProtocol"
redirectPort="8443" />

Thanks


2014-09-03 16:59 GMT-03:00 Howard W. Smith, Jr. <sm...@gmail.com>:

> I use it, since I am using PrimeFaces Push in my web app.
>
> what problems are you having? how are you deploying and/or packaging
> atmosphere-runtime?
>
>
>
> On Wed, Sep 3, 2014 at 3:16 PM, Felipe Jaekel <fk...@gmail.com> wrote:
>
> > Hi,
> >
> > Does anyone uses atmosphere-runtime in production with TomEE plus 1.7.0?
> I
> > had some problems when I tried it in a regular Tomcat 7 some time ago.
> >
> > Thanks
> >
>

Re: Does anyone uses atmosphere-runtime in production?

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
I use it, since I am using PrimeFaces Push in my web app.

what problems are you having? how are you deploying and/or packaging
atmosphere-runtime?



On Wed, Sep 3, 2014 at 3:16 PM, Felipe Jaekel <fk...@gmail.com> wrote:

> Hi,
>
> Does anyone uses atmosphere-runtime in production with TomEE plus 1.7.0? I
> had some problems when I tried it in a regular Tomcat 7 some time ago.
>
> Thanks
>