You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Rolf Schäuble (Created JIRA)" <ji...@apache.org> on 2011/12/06 16:11:40 UTC

[jira] [Created] (CXF-3959) CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects

CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects
-------------------------------------------------------------------------

                 Key: CXF-3959
                 URL: https://issues.apache.org/jira/browse/CXF-3959
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.5, 2.4.2
            Reporter: Rolf Schäuble
         Attachments: cxf-postconstruct-bug.zip

Under the following circumstances, @PostConstruct methods on classes exported as JAX-WS WebService are invoked twice:
- The application uses Spring as IoC container
- Spring's support for JSR 250 annotations is active (using the CommonAnnotationBeanPostProcessor bean or <context:annotation-config/>
- The exported bean is declared as Spring bean in the application context
- The <jaxws:endpoint> declaration refers to the declared bean (<jaxws:endpoint implementor="#beanName"/>

The last point is important:
- <jaxws:endpoint implementor="the.bean.class.name"/> *does not* not show the wrong behavior
- <bean id="theBean" class="the.bean.class.name"/>
  <jaxws:endpoint implementor="#theBean'"/> *does* show the wrong behaviur
  
I have built an example application (based on CXF's java_first_spring_support sample) that shows the problem. It contains two classes:
1. PostConstructCalledOnce: this class is exported using the <jaxws:endpoint implementor="the.bean.class.name"/> synxtax
2. PostConstructCalledTwice.java: this class is exported using the <jaxws:endpoint implementor="#theBean'"/>

Both classes contain a postConstruct method; both method print the class's name to the console. When the application is started ("mvn -Pserver"), it can be observed that PostConstructCalledOnce#postConstruct is called once and PostConstructCalledTwice#postConstruct is called twice.

Desired behavior: both postConstruct methods should only be invoked once.

Workaround:
1. Annotate the affected classes with CXF's @NoJSR250Annotations annotation
2. Use the <jaxws:endpoint implementor="the.bean.class.name"/> syntax. Problem: This way, Spring is not able to wrap the bean with a proxy (e.g. for transaction support)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-3959) CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects

Posted by "Rolf Schäuble (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rolf Schäuble updated CXF-3959:
-------------------------------

    Attachment: cxf-postconstruct-bug.zip

Sample application that demonstrates the problem.
                
> CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects
> -------------------------------------------------------------------------
>
>                 Key: CXF-3959
>                 URL: https://issues.apache.org/jira/browse/CXF-3959
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2, 2.5
>            Reporter: Rolf Schäuble
>         Attachments: cxf-postconstruct-bug.zip
>
>
> Under the following circumstances, @PostConstruct methods on classes exported as JAX-WS WebService are invoked twice:
> - The application uses Spring as IoC container
> - Spring's support for JSR 250 annotations is active (using the CommonAnnotationBeanPostProcessor bean or <context:annotation-config/>
> - The exported bean is declared as Spring bean in the application context
> - The <jaxws:endpoint> declaration refers to the declared bean (<jaxws:endpoint implementor="#beanName"/>
> The last point is important:
> - <jaxws:endpoint implementor="the.bean.class.name"/> *does not* not show the wrong behavior
> - <bean id="theBean" class="the.bean.class.name"/>
>   <jaxws:endpoint implementor="#theBean'"/> *does* show the wrong behaviur
>   
> I have built an example application (based on CXF's java_first_spring_support sample) that shows the problem. It contains two classes:
> 1. PostConstructCalledOnce: this class is exported using the <jaxws:endpoint implementor="the.bean.class.name"/> synxtax
> 2. PostConstructCalledTwice.java: this class is exported using the <jaxws:endpoint implementor="#theBean'"/>
> Both classes contain a postConstruct method; both method print the class's name to the console. When the application is started ("mvn -Pserver"), it can be observed that PostConstructCalledOnce#postConstruct is called once and PostConstructCalledTwice#postConstruct is called twice.
> Desired behavior: both postConstruct methods should only be invoked once.
> Workaround:
> 1. Annotate the affected classes with CXF's @NoJSR250Annotations annotation
> 2. Use the <jaxws:endpoint implementor="the.bean.class.name"/> syntax. Problem: This way, Spring is not able to wrap the bean with a proxy (e.g. for transaction support)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (CXF-3959) CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects

Posted by "Daniel Kulp (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3959.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.5.1
                   2.4.5
    
> CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects
> -------------------------------------------------------------------------
>
>                 Key: CXF-3959
>                 URL: https://issues.apache.org/jira/browse/CXF-3959
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2, 2.5
>            Reporter: Rolf Schäuble
>            Assignee: Daniel Kulp
>             Fix For: 2.4.5, 2.5.1
>
>         Attachments: cxf-postconstruct-bug.zip
>
>
> Under the following circumstances, @PostConstruct methods on classes exported as JAX-WS WebService are invoked twice:
> - The application uses Spring as IoC container
> - Spring's support for JSR 250 annotations is active (using the CommonAnnotationBeanPostProcessor bean or <context:annotation-config/>
> - The exported bean is declared as Spring bean in the application context
> - The <jaxws:endpoint> declaration refers to the declared bean (<jaxws:endpoint implementor="#beanName"/>
> The last point is important:
> - <jaxws:endpoint implementor="the.bean.class.name"/> *does not* not show the wrong behavior
> - <bean id="theBean" class="the.bean.class.name"/>
>   <jaxws:endpoint implementor="#theBean'"/> *does* show the wrong behaviur
>   
> I have built an example application (based on CXF's java_first_spring_support sample) that shows the problem. It contains two classes:
> 1. PostConstructCalledOnce: this class is exported using the <jaxws:endpoint implementor="the.bean.class.name"/> synxtax
> 2. PostConstructCalledTwice.java: this class is exported using the <jaxws:endpoint implementor="#theBean'"/>
> Both classes contain a postConstruct method; both method print the class's name to the console. When the application is started ("mvn -Pserver"), it can be observed that PostConstructCalledOnce#postConstruct is called once and PostConstructCalledTwice#postConstruct is called twice.
> Desired behavior: both postConstruct methods should only be invoked once.
> Workaround:
> 1. Annotate the affected classes with CXF's @NoJSR250Annotations annotation
> 2. Use the <jaxws:endpoint implementor="the.bean.class.name"/> syntax. Problem: This way, Spring is not able to wrap the bean with a proxy (e.g. for transaction support)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Assigned] (CXF-3959) CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects

Posted by "Daniel Kulp (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-3959:
--------------------------------

    Assignee: Daniel Kulp
    
> CXF JAX-WS: @PostConstruct methods invoked twice in Spring-based projects
> -------------------------------------------------------------------------
>
>                 Key: CXF-3959
>                 URL: https://issues.apache.org/jira/browse/CXF-3959
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2, 2.5
>            Reporter: Rolf Schäuble
>            Assignee: Daniel Kulp
>         Attachments: cxf-postconstruct-bug.zip
>
>
> Under the following circumstances, @PostConstruct methods on classes exported as JAX-WS WebService are invoked twice:
> - The application uses Spring as IoC container
> - Spring's support for JSR 250 annotations is active (using the CommonAnnotationBeanPostProcessor bean or <context:annotation-config/>
> - The exported bean is declared as Spring bean in the application context
> - The <jaxws:endpoint> declaration refers to the declared bean (<jaxws:endpoint implementor="#beanName"/>
> The last point is important:
> - <jaxws:endpoint implementor="the.bean.class.name"/> *does not* not show the wrong behavior
> - <bean id="theBean" class="the.bean.class.name"/>
>   <jaxws:endpoint implementor="#theBean'"/> *does* show the wrong behaviur
>   
> I have built an example application (based on CXF's java_first_spring_support sample) that shows the problem. It contains two classes:
> 1. PostConstructCalledOnce: this class is exported using the <jaxws:endpoint implementor="the.bean.class.name"/> synxtax
> 2. PostConstructCalledTwice.java: this class is exported using the <jaxws:endpoint implementor="#theBean'"/>
> Both classes contain a postConstruct method; both method print the class's name to the console. When the application is started ("mvn -Pserver"), it can be observed that PostConstructCalledOnce#postConstruct is called once and PostConstructCalledTwice#postConstruct is called twice.
> Desired behavior: both postConstruct methods should only be invoked once.
> Workaround:
> 1. Annotate the affected classes with CXF's @NoJSR250Annotations annotation
> 2. Use the <jaxws:endpoint implementor="the.bean.class.name"/> syntax. Problem: This way, Spring is not able to wrap the bean with a proxy (e.g. for transaction support)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira