Geronimo
  1. Geronimo
  2. GERONIMO-6384

@PostConstruct have to be called after the object is initialized and after dependency injection is performed

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.2, 3.0.1, 2.1.9
    • Fix Version/s: None
    • Component/s: myfaces
    • Security Level: public (Regular issues)
    • Labels:
      None

      Description

      @PostConstruct have to be called after the object is initialized and after dependency injection is performed

      But now in Geronimo, @PostConstruct is called before @ManagedProperty dependency injection is performed.

      1. testJSF.war
        5 kB
        Shawn Jiang

        Activity

        Hide
        Shawn Jiang added a comment -

        We need to pick up the fix in the integration code.

        https://issues.apache.org/jira/browse/MYFACES-1761

        Show
        Shawn Jiang added a comment - We need to pick up the fix in the integration code. https://issues.apache.org/jira/browse/MYFACES-1761
        Hide
        Shawn Jiang added a comment -

        This is the app to recreate this issue.

        Show
        Shawn Jiang added a comment - This is the app to recreate this issue.
        Hide
        Tina Li added a comment -

        Hi Shawn,

        I'll try to investigate this issue.

        Show
        Tina Li added a comment - Hi Shawn, I'll try to investigate this issue.
        Hide
        Shawn Jiang added a comment -

        Shawn Jiang submitted changeset revision 1379359 to 3.0 in geronimo_server (2 files) - 31/Aug/12 09:35

        GERONIMO-6384 @PostConstruct have to be called after the object is initialized and after dependency injection is performed

        branches/3.0/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java (+38 -31) View diff to previous View full source View file history Download raw file
        branches/3.0/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderGBean.java

        Show
        Shawn Jiang added a comment - Shawn Jiang submitted changeset revision 1379359 to 3.0 in geronimo_server (2 files) - 31/Aug/12 09:35 GERONIMO-6384 @PostConstruct have to be called after the object is initialized and after dependency injection is performed branches/3.0/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java (+38 -31) View diff to previous View full source View file history Download raw file branches/3.0/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderGBean.java
        Hide
        Tina Li added a comment -

        Tested on the latest build, deployed the application testJSF.war, and access the url:http://localhost:8080/testJSF/index.xhtml
        Check console info, can find:

        service=org.apache.test.sjf.Service@6d19cdcf
        ------------postConstruct !!
        service=org.apache.test.sjf.Service@6d19cdcf

        @PostConstruct was called after the object was initialized and dependency injection was performed.

        Before the fix, test result is:

        service=null
        ------------postConstruct !!
        service=null

        Show
        Tina Li added a comment - Tested on the latest build, deployed the application testJSF.war, and access the url: http://localhost:8080/testJSF/index.xhtml Check console info, can find: service=org.apache.test.sjf.Service@6d19cdcf ------------postConstruct !! service=org.apache.test.sjf.Service@6d19cdcf @PostConstruct was called after the object was initialized and dependency injection was performed. Before the fix, test result is: service=null ------------postConstruct !! service=null
        Hide
        Tina Li added a comment -

        When stop this web application, happened warning message:
        2012-09-03 16:39:09,417 WARN [[/testJSF]] Cannot serialize session attribute helloWorldBean for session 87924F271A59EC28D34DA43F3C1A99E5
        java.io.NotSerializableException: org.apache.test.sjf.Service
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
        at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1671)
        at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1077)
        at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:432)
        at org.apache.catalina.session.StandardManager.unload(StandardManager.java:353)
        at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:518)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5462)
        at org.apache.geronimo.tomcat.GeronimoStandardContext.stopInternal(GeronimoStandardContext.java:738)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.geronimo.tomcat.GeronimoStandardContext.kill(GeronimoStandardContext.java:438)
        at org.apache.geronimo.tomcat.TomcatContainer.removeContext(TomcatContainer.java:331)
        at org.apache.geronimo.tomcat.TomcatWebAppContext.doStop(TomcatWebAppContext.java:599)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.destroyInstance(GBeanInstance.java:1191)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStop(GBeanInstanceState.java:346)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.stop(GBeanInstanceState.java:191)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.stop(GBeanInstance.java:577)
        at org.apache.geronimo.kernel.basic.BasicKernel.stopGBean(BasicKernel.java:430)
        at org.apache.geronimo.kernel.osgi.ConfigurationActivator.stopRecursive(ConfigurationActivator.java:157)
        at org.apache.geronimo.kernel.osgi.ConfigurationActivator.stop(ConfigurationActivator.java:103)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:771)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:764)
        at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:510)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:565)
        at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1161)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:595)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215)
        at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:284)
        at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:691)
        at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:598)
        at org.eclipse.osgi.framework.internal.core.InternalSystemBundle$1.run(InternalSystemBundle.java:261)
        at java.lang.Thread.run(Thread.java:662)

        This message also happened before the fix.

        Show
        Tina Li added a comment - When stop this web application, happened warning message: 2012-09-03 16:39:09,417 WARN [ [/testJSF] ] Cannot serialize session attribute helloWorldBean for session 87924F271A59EC28D34DA43F3C1A99E5 java.io.NotSerializableException: org.apache.test.sjf.Service at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1671) at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1077) at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:432) at org.apache.catalina.session.StandardManager.unload(StandardManager.java:353) at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:518) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5462) at org.apache.geronimo.tomcat.GeronimoStandardContext.stopInternal(GeronimoStandardContext.java:738) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at org.apache.geronimo.tomcat.GeronimoStandardContext.kill(GeronimoStandardContext.java:438) at org.apache.geronimo.tomcat.TomcatContainer.removeContext(TomcatContainer.java:331) at org.apache.geronimo.tomcat.TomcatWebAppContext.doStop(TomcatWebAppContext.java:599) at org.apache.geronimo.gbean.runtime.GBeanInstance.destroyInstance(GBeanInstance.java:1191) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStop(GBeanInstanceState.java:346) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.stop(GBeanInstanceState.java:191) at org.apache.geronimo.gbean.runtime.GBeanInstance.stop(GBeanInstance.java:577) at org.apache.geronimo.kernel.basic.BasicKernel.stopGBean(BasicKernel.java:430) at org.apache.geronimo.kernel.osgi.ConfigurationActivator.stopRecursive(ConfigurationActivator.java:157) at org.apache.geronimo.kernel.osgi.ConfigurationActivator.stop(ConfigurationActivator.java:103) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:771) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:764) at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:510) at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:565) at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1161) at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:595) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257) at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215) at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:284) at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:691) at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:598) at org.eclipse.osgi.framework.internal.core.InternalSystemBundle$1.run(InternalSystemBundle.java:261) at java.lang.Thread.run(Thread.java:662) This message also happened before the fix.

          People

          • Assignee:
            Shawn Jiang
            Reporter:
            Shawn Jiang
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development