Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-1286

Bug in reporting invalid @PostActivate/@PrePassivate usage in Stateful and Singleton beans

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1.1, 3.1.2
    • Fix Version/s: 3.1.3
    • Component/s: deployment
    • Labels:
      None

      Description

      Instead of the appropriate warning saying using these annotations is not valid unless the bean is @Stateful, users would instead see:

      java.lang.UnsupportedOperationException
      at java.util.AbstractList.add(AbstractList.java:131)
      at java.util.AbstractList.add(AbstractList.java:91)
      at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.processCallbacks(AnnotationDeployer.java:2080)
      at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1069)
      at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:680)
      at org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:194)
      at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
      at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:612)
      at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:562)
      at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:391)
      at org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:300)
      at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
      at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
      at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
      at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
      at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)

      The correct output should be warnings like the following:

      WARN - WARN ... TestStateless: @PrePassivate is ignored for beans of type Stateless. Method: myPassivate
      WARN - WARN ... TestStateless: @PostActivate is ignored for beans of type Stateless. Method: myActivate
      WARN - WARN ... TestSingleton: @PrePassivate is ignored for beans of type Singleton. Method: myPassivate
      WARN - WARN ... TestSingleton: @PostActivate is ignored for beans of type Singleton. Method: myActivate

        Attachments

          Activity

            People

            • Assignee:
              dblevins David Blevins
              Reporter:
              dblevins David Blevins
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: