[
https://issues.jboss.org/browse/RF-12896?page=com.atlassian.jira.plugin.s...
]
Lukáš Fryč commented on RF-12896:
---------------------------------
The problem is the RichFaces' ServiceFactory which holds reference to
PushContextFactory leaks from first deployment to next deployments in case of RichFaces
JAR as a module - thus [during
initialization|https://github.com/richfaces/core/blob/master/impl/src/mai...]
across several deployments, we [get the same instance of
PushContext|https://github.com/richfaces/core/blob/master/impl/src/main/j...]
which doesn't have a TopicsContext instance set (might be due to serialization).
That's why we need to initialize it using {{PushContext#init(FacesContext)}} method
before we want to use it.
The better workaround might be initializating the PushContext once JSF is loaded
(similarly to {{InitializationListener}}, on
[{{PostConstructApplication}}|https://github.com/richfaces/core/blob/master/impl/src/main/resources/META-INF/faces-config.xml#L14]).
----
Note that when RichFaces is used a module, its services likely leaks from one deployment
to another.
In order to fix this issue properly, we would need to either isolate deployments (load
RichFaces for each deployment separately) or remove binding of deployments' services
to TCCL.
Richfaces TopicsContext.lookup() returns null after redeployment when
Richfaces is deployed as a module in JBoss EAP 6
----------------------------------------------------------------------------------------------------------------------
Key: RF-12896
URL:
https://issues.jboss.org/browse/RF-12896
Project: RichFaces
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.2.3.Final
Reporter: Ilia Vassilev
Assignee: Brian Leathem
Fix For: 4.3.2
Attachments: jboss-as-helloworld-rf.war, modules.zip, RichBean.java
Our application uses Richfaces push functionality and makes a call to lookup the
TopicsContext in the constructor of one of a backing bean. The code looks like this below.
This works fine when Richfaces is packaged in the war, however when we extract the
richfaces jars into a module and have our applications declare a module dependency, there
is an issue when we redeploy the application. It works fine when JBoss is first started,
but if we redeploy the application while JBoss is running, we are getting a
NullPointerException in our application because TopicsContext.lookup() is returning null.
{code}
@PostConstruct
public void postContruct() {
TopicsContext topicsContext = TopicsContext.lookup();
if(topicsContext == null)
log(" - topicsContext is NULL");
pushTK = new TopicKey(PUSH_TOPIC);
// this will fail if topicsContext is null (NPE)
topicsContext.getOrCreateTopic(pushTK);
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira