Cannot get/set configuration object

I am trying to set the agent configuration object as follows:

 function void build_phase (uvm_phase phase);
    memory_agent_config_h = new(UVM_ACTIVE);
    uvm_config_db #(memory_agent_config)::set(this, "memory_agent_h*", "memory_config", memory_agent_config_h);
    memory_agent_h = new("memory_agent_h", this);      
  endfunction : build_phase 

In the agent, I get it as follows:

 function void build_phase(uvm_phase phase);
        if(!uvm_config_db #(memory_agent_config)::get(this, "", "memory_config", memory_agent_config_h));
            `uvm_fatal("MEMORY_AGENT", "Failed to get configuration object");
    endfunction : build_phase

It cannot find any mistakes in my get and set parameters, but the uvm_fatal is always invoked. What could be the problem?

I also tried using +UVM_CONFIG_DB_TRACE
and I get this:


# UVM_INFO verilog_src/uvm-1.1d/src/base/uvm_resource_db.svh(121) @ 0: reporter [CFGDB/SET] Configuration 'uvm_test_top.memory_agent_h*.memory_config' (type class pkg_memory::memory_agent_config) set by uvm_test_top = (class pkg_memory::memory_agent_config) UVM_ACTIVE null

# UVM_INFO verilog_src/uvm-1.1d/src/base/uvm_resource_db.svh(121) @ 0: reporter [CFGDB/GET] Configuration 'uvm_test_top.memory_agent_h.memory_config' (type class pkg_memory::memory_agent_config) read by uvm_test_top.memory_agent_h = (class pkg_memory::memory_agent_config) UVM_ACTIVE null

In reply to OYounis:

You have a semi-colon after the if statement when doing the get(). This makes it a standalone statement and the `uvm_fatal() message will always be called since it is a separate statement.