Bug #2423


vHostManager has not yet been set when a component's start() method is called

Added by Gabriel Rossetti over 4 years ago. Updated over 4 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Applicable version:
Source Code Disclaimer:


When calling getDefVHostItem() from a component's start() method you get the real hostname instead due to the fact that the vHostManager has not been set yet:

public class MyComponent extends AbstractMessageReceiver {


public void start() {


log.debug("addrs is: {}", getDefVHostItem().toString()); // this will print the real hostname instead of the virtual hostname



When you initialize/start a componenet this should already be set since the server has already parsed at this point.

Please see here for more info:


#1 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam over 4 years ago

  • Status changed from New to Rejected
  • Assignee set to Artur Hefczyc

The start() method is called only to start/initialize components' own data and mechanisms. All components start/can start at the same time concurrently, so there can be no dependency on any other component or assumption that something else is already initialized.

If you need to do something when the whole server started up and all other components are initialized, you can use initializationCompleted() method, which is called when the server is basically ready to process user's data. There are 2 remarks for this however:

  1. The method initializationCompleted() really means that initialization is completed, even for your component. This really means that at this point the component must be ready to accept data for processing. Therefore, this method can be only used for some "post-initialization" actions or initialization of elements on which stanza processing does not depends.

  2. The getDefVHostItem() is actually different from everything else.Hostname information is taken from DNS system which may take long time. It is executed on a separate thread, so the time when the real hostname is available to the system depends how quickly DNS system can obtain this information.

Also available in: Atom PDF