albfernandez / jboss-seam

Seam 2: enterprise Java development framework
http://albfernandez.github.io/jboss-seam/
GNU Lesser General Public License v3.0
11 stars 5 forks source link

Fix for JBSEAM-4806 is breaking Asynchronous initialization #21

Closed stolp closed 5 years ago

stolp commented 5 years ago

First of all thanks for providing further patches to SEAM, this is very helpful and much appreciated.

After updating our application to SEAM 2.3.14, I noticed the following issue regarding Asynchronous behaviour (we are using the QuartzDispatcher in our case).

The changes to Lifecycle.java regarding the fix for JBSEAM-4806 are having a detriment effect on the Asynchronous intialization code as shown in the stackdump below.

Caused by: java.lang.NullPointerException: map can not be null at java.util.Objects.requireNonNull(Objects.java:228) at org.jboss.seam.contexts.BasicContext.(BasicContext.java:29) at org.jboss.seam.contexts.ApplicationContext.(ApplicationContext.java:26) at org.jboss.seam.contexts.Lifecycle.beginCall(Lifecycle.java:91) at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.setup(Asynchronous.java:54) at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:77) at org.jboss.seam.async.AsynchronousInvocation.handleException(AsynchronousInvocation.java:96) at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:247) at org.quartz.core.JobRunShell.run(JobRunShell.java:223)

I reverted the changes to Lifecycle.java to the last official version and the issue disappeared.

There is probably a better solution, yet this is currently working for us.

Please let me know if I can add information.

albfernandez commented 5 years ago

I'm not familiar with quartz. Is the example at https://github.com/albfernandez/jboss-seam/tree/Seam_2_3_jee7/examples/quartz/quartz-web similar to your case (to start testing)?

susp248 commented 5 years ago

Yes, I think this is close enough.

But from the changes in JBSEAM-4806 and the stacktrace I think the relevant part is in the handling of Asynchronous and quartz itself is not really relevant here.

albfernandez commented 5 years ago

I've submitted a patch. Could you try it please?

I've used quarz example (which failed with the same NPE) to test the patch. Please tell me if it fixes it for you.