NOA while trying to use RAL adapter for register access

In my env class I am assigning a handle to register file:

      reg_file             reg_ral_h;
      sample_adapter       reg_adapter_h;
      sample_agent         m_agent;

in build phase:

m_agent = sample_agent::type_id::create("m_agent", this);

reg_ral_h = reg_file::type_id::create ("reg_ral_h", this);
reg_ral_h.build();
reg_ral_h.default_map.set_base_addr(`BLOCK_BASE_ADDR);
reg_ral_h.set_hdl_path_root(reg_hdl_path);
reg_ral_h.lock_model();

In Connect phase:

reg_adapter_h = new();
reg_ral_h.default_map.set_sequencer(m_agent.m_sequencer, reg_adapter_h);  <<--- THIS Is where the NOA is pointing to

Error is:
The object at dereference depth 1 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it.

Have been looking at this code all night! cant seem to root cause why it still complains about NOA. Any inputs are greatly appreciated!

In reply to ss4321:

This is too little code to give you an advice. Especially we do not see what is in the connect_phase.

And 2 remarks:
(1) why do you use the reg_file und not the reg_block conatining the reg model?
(2) Because the RAL is not part of the TB hierarchy it is a good approach to put the reg model into a configuration object which is itself passed to the config_db. Then you can retrieve this in any place from the config_db.

In reply to chr_sue:

It does not matter if you use different naming conventions or do not use config_db for simple testbench environment.

Basically, the error says you are using class handles before creating objects on it. From your code it looks like regmodel and adapter are ok. Check if sequencer is created there in agent.

To debug further you can also comment erroneous code then run if(comp == null) on all above class handles…

In reply to MayurKubavat:

In reply to chr_sue:
It does not matter if you use different naming conventions or do not use config_db for simple testbench environment.

Could you please explain what you mean with naming conventions?