Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3196

Confusing IllegalStateException: WELD-000340: A request must be associated with the context when mixing JSF/CDI

    XMLWordPrintable

    Details

      Description

      I have a simple web app doing injection into a JSF managed bean using @EJB. When the managed bean lifecycle and duration is described using the JSF @ManagedBean and @ApplicationScoped I get a "IllegalStateException: WELD-000340 ..." error when loading the welcome page. The only workaround I have seen is to disable implicit CDI usage, but the web app is using CDI, so that is not appropriate.

      The problem seems to be a lack of understanding what is going on between the weld and jsf containers. I understand that the JSF @ManagedBean is deprecated in favor of CDI @Named, but it would be nice if we can provide better feedback when @ManagedBean is used along with CDI.

      The following git repo provides a complete test application along with the steps to cause the error as well as how to fix it by only using CDI annotations.

      https://github.com/starksm64/clock-jsf-test

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jharting Jozef Hartinger
              Reporter:
              starksm64 Scott Stark (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: