You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2023/10/17 23:23:00 UTC

[jira] [Assigned] (CXF-8943) Adding a listener for Container events is not working on Jetty 9

     [ https://issues.apache.org/jira/browse/CXF-8943?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andriy Redko reassigned CXF-8943:
---------------------------------

    Assignee: Andriy Redko

> Adding a listener for Container events is not working on Jetty 9
> ----------------------------------------------------------------
>
>                 Key: CXF-8943
>                 URL: https://issues.apache.org/jira/browse/CXF-8943
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.6.2
>         Environment: Spring Boot 2.7
> Camel 3.21.1
> CXF 3.6.2
>            Reporter: Ruslan Hryn
>            Assignee: Andriy Redko
>            Priority: Critical
>         Attachments: Screenshot from 2023-10-10 20-01-23.png
>
>
> Adding a listener for Container events is not working on Jetty 9
> For example. 
> Add listener using JettyHTTPServerEngine
> {code:java}
> @Bean
> public JettyHTTPServerEngineFactory jettyHTTPServerEngineFactory() {
>     JettyHTTPServerEngineFactory engineFactory = new JettyHTTPServerEngineFactory();
>     JettyHTTPServerEngine engine = new JettyHTTPServerEngine(
>             new Container.Listener() {
>                 @Override
>                 public void beanAdded(Container parent, Object child) {
>                     //
>                 }
>                 @Override
>                 public void beanRemoved(Container parent, Object child) {
>                     //
>                 }
>             },
>             "localhost",
>             8080);
>     engineFactory.setEnginesList(Collections.singletonList(engine));
>     return engineFactory;
> }{code}
> The JettyHTTPServerEngine can't add this listener after the start of the server 
> because Server class does not implement addEventListener method directly, this method comes from the parent class. 
> Therefore 
> ReflectionUtil.getDeclaredMethods(container.getClass()) does not return the method addEventListener because this call does not consider methods from parent classes.
>  
> The issue was caused by this commit [https://github.com/apache/cxf/commit/2ff109358027653d1afd6f252cf6f25048cafbb9]
> !Screenshot from 2023-10-10 20-01-23.png!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)