OpenEJB
  1. OpenEJB
  2. OPENEJB-1824

TomEE wrongly detecte disabled beans as broken

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: tomee
    • Labels:
      None

      Description

      The latest TomEE build detects disabled beans as broken and reports a Serialization check issue.

      org.apache.webbeans.exception.WebBeansConfigurationException: Passivation scoped defined bean must be passivation capable, but bean : TissClientConfig, Name:null, WebBeans Type:MANAGED, API Types:[org.apache.myfaces.extensions.cdi.jsf.api.config.ClientConfig,at.ac.tuwien.tiss.core.fe.codi.TissClientConfig,java.io.Serializable,java.lang.Object], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default] is not passivation capable
      at org.apache.openejb.cdi.BeansDeployer.checkPassivationScope(BeansDeployer.java:392)
      at org.apache.openejb.cdi.BeansDeployer.validate(BeansDeployer.java:253)
      at org.apache.openejb.cdi.BeansDeployer.validateInjectionPoints(BeansDeployer.java:215)
      at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:286)
      at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:108)
      at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:50)

      The bean looks like the following:

      @SessionScoped
      @Alternative
      public class TissClientConfig extends ClientConfig implements Serializable {

      The problem is that in my case the Alternative is not enabled via beans.xml. Thus it is disabled, in which case the WebBeansUtil#isPassivationCapable(Contextual<?> contextual) returns null.
      This works as documented:
      > @return the uniqueId if it is

      {@link PassivationCapable}

      and enabled

      The solution: Someone removed the following lines from the class you copied from owb to openejb:
      if (bean instanceof OwbBean && !((OwbBean)bean).isEnabled())

      { // we skip disabled beans continue; }

      Disabled beans do not need to be valid in a CDI sense at all. That might be the reason why they got disabled during the boot.

      I will provide a patch to fix this. Just doing some 7up and testing.

      1. OPENEJB-1824.patch
        0.8 kB
        Mark Struberg

        Activity

        Hide
        Mark Struberg added a comment -

        This patch fixes the problem.

        Please note that we should revisit classes which got forked from OWB to TomEE and check what can be merged back/fixed. I'd rather have a bit less duplicated code, otherwise we will soon be in a maintenance hell

        Show
        Mark Struberg added a comment - This patch fixes the problem. Please note that we should revisit classes which got forked from OWB to TomEE and check what can be merged back/fixed. I'd rather have a bit less duplicated code, otherwise we will soon be in a maintenance hell
        Hide
        David Blevins added a comment -

        Thank you, Mark!!

        Show
        David Blevins added a comment - Thank you, Mark!!
        Hide
        David Blevins added a comment -
        Show
        David Blevins added a comment - 2012-04-21 - http://svn.apache.org/viewvc?view=revision&revision=1328783 - dblevins

          People

          • Assignee:
            Mark Struberg
            Reporter:
            Mark Struberg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development