[richfaces-issues] [JBoss JIRA] (RF-11933) Push: user-friendly topics initialization on startup

Lukáš Fryč (JIRA) jira-events at lists.jboss.org
Tue Feb 7 14:50:48 EST 2012


     [ https://issues.jboss.org/browse/RF-11933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukáš Fryč updated RF-11933:
----------------------------

    Fix Version/s: 4.2.0.Final

    
> Push: user-friendly topics initialization on startup
> ----------------------------------------------------
>
>                 Key: RF-11933
>                 URL: https://issues.jboss.org/browse/RF-11933
>             Project: RichFaces
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>          Components: core
>    Affects Versions: 4.2.0.CR1
>            Reporter: Lukáš Fryč
>             Fix For: 4.2.0.Final
>
>
> Currently, when custom threads (like JMS) out of {{FacesContext}} context tries to initialize {{PushContext}} e.g. by {{TopicsContext.lookup()}}, initializations fails with:
> {code}
> 11:12:39,189 ERROR [stderr] (MessageProducerThread) Exception in thread "MessageProducerThread" java.lang.ExceptionInInitializerError
> 11:12:39,191 ERROR [stderr] (MessageProducerThread) 	at org.richfaces.application.push.impl.PushContextFactoryImpl.getPushContext(PushContextFactoryImpl.java:89)
> 11:12:39,191 ERROR [stderr] (MessageProducerThread) 	at org.richfaces.application.push.TopicsContext.lookup(TopicsContext.java:79)
> 11:12:39,192 ERROR [stderr] (MessageProducerThread) 	at org.richfaces.demo.push.TopicsContextMessageProducer.sendMessage(TopicsContextMessageProducer.java:45)
> 11:12:39,192 ERROR [stderr] (MessageProducerThread) 	at org.richfaces.demo.push.MessageProducerRunnable.run(MessageProducerRunnable.java:57)
> 11:12:39,192 ERROR [stderr] (MessageProducerThread) 	at java.lang.Thread.run(Thread.java:662)
> 11:12:39,192 ERROR [stderr] (MessageProducerThread) Caused by: java.lang.NullPointerException
> 11:12:39,192 ERROR [stderr] (MessageProducerThread) 	at org.richfaces.application.push.impl.PushContextFactoryImpl.createInstance(PushContextFactoryImpl.java:74)
> 11:12:39,193 ERROR [stderr] (MessageProducerThread) 	at org.richfaces.application.push.impl.PushContextFactoryImpl.access$0(PushContextFactoryImpl.java:71)
> 11:12:39,193 ERROR [stderr] (MessageProducerThread) 	at org.richfaces.application.push.impl.PushContextFactoryImpl$PushContextHolder.<clinit>(PushContextFactoryImpl.java:43)
> 11:12:39,193 ERROR [stderr] (MessageProducerThread) 	... 5 more
> {code}
> and then any other try for accessing context fails with:
> {code}
> 11:19:45,829 INFO  [javax.enterprise.resource.webcontainer.jsf.context] (http--0.0.0.0-8080-4) Exception when handling error trying to reset the response.: java.lang.NoClassDefFoundError: Could not initialize class org.richfaces.application.push.impl.PushContextFactoryImpl$PushContextHolder
> 	at org.richfaces.application.push.impl.PushContextFactoryImpl.getPushContext(PushContextFactoryImpl.java:89) [richfaces-core-impl-4.2.0-SNAPSHOT.jar:]
> 	at org.richfaces.renderkit.PushRendererBase.getPushHandlerUrl(PushRendererBase.java:55) [richfaces-components-ui-4.2.0-SNAPSHOT.jar:]
> 	at org.richfaces.renderkit.html.PushRenderer.encodeEnd(PushRenderer.java:89) [richfaces-components-ui-4.2.0-SNAPSHOT.jar:]
> {code}
> ----
> Users can initialize {{PushContext}} with {{web.xml}} param:
> * {{org.richfaces.push.initializeOnStartup}}
> ** we don't initialize on startup automatically, since not every app needs Push
> but current impl is quite a bit unfriendly, since it throws the exceptions above and do not get any solution.
> ----
> I would recommend following improvements:
> * sensible default = automatically initialize on startup when {{org.richfaces.push.jms.enabled = true}}
> ** when user configures app to use Push JMS integration, it's clear he wants to use Push
> * log error with message describing how to use context-param {{org.richfaces.push.initializeOnStartup}}
> ** to allow user configure this option without need for studying documentation
> * throw framework-specific unchecked exception (e.g. {{PushContextInitializationException}})
> ** it will allow to handle these exceptions by application (waiting for initialization)
> * hold {{PushContext}} singleton reference in {{AtomicReference}} instead of in [static inner class|https://github.com/richfaces/core/blob/develop/impl/src/main/java/org/richfaces/application/push/impl/PushContextFactoryImpl.java#L43]
> ** allows app to initialize context once {{FacesContext}} available and do not fail with {{NoClassDefFoundError: Could not initialize class PushContextFactoryImpl$PushContextHolder}}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the richfaces-issues mailing list