What are the reasons to get UVM_FATAL ERROR in UVM for below code

UVM_INFO @ 0: reporter [RNTST] Running test test…
UVM_FATAL …/Test/test.sv(46) @ 0: uvm_test_top [Write22 TEST CONFIG] FAILED




class test extends uvm_test;

`uvm_component_utils(test)


environ env;
wragent mas_agent;
rdagent sa_agent;

wrconfigure wrcfg;
rdconfigure rdcfg;

virsequence vseq;

configure envcfg;


bit has_magent=1;
bit has_sagent=1;


extern function new (string name = "test", uvm_component parent);
extern function void build_phase(uvm_phase phase);
//extern task run_phase(uvm_phase phase);
extern function void end_of_elaboration_phase(uvm_phase phase);

endclass: test

function test::new(string name = "test", uvm_component parent);
super.new(name,parent);
endfunction: new

function void test::build_phase(uvm_phase phase);
super.build_phase(phase);
env=environ::type_id::create("env",this);
envcfg=configure::type_id::create("envcfg");
wrcfg=wrconfigure::type_id::create("wrcfg");
rdcfg=rdconfigure::type_id::create("rdcfg");

if(has_magent) 
begin
	wrcfg.is_active = UVM_ACTIVE;


if(!uvm_config_db #(virtual interfa)::get(this,"","intff",wrcfg.intff))
	`uvm_fatal("Write22 TEST CONFIG","FAILED");

uvm_config_db #(wrconfigure)::set(this,"*","wrconfigure",wrcfg);

wrcfg=envcfg.wrcfg;

end

if(has_sagent)
begin
rdcfg.is_active = UVM_ACTIVE;



if(!uvm_config_db #(virtual interfa)::get(this,"","intff",rdcfg.intff))
	`uvm_fatal("READ TEST CONFIG","FAILED");

uvm_config_db #(rdconfigure)::set(this,"*","rdconfigure",rdcfg);

 rdcfg=envcfg.rdcfg;

end

envcfg.has_magent=has_magent;
envcfg.has_sagent=has_sagent;

uvm_config_db #(configure)::set(this,"*","configure",envcfg);

endfunction: build_phase

function void test::end_of_elaboration_phase(uvm_phase phase);
	uvm_top.print_topology();
endfunction


/*task test::run_phase(uvm_phase phase);
phase.raise_objection(this);
vseq.start(env.vseqrh);
phase.drop_objection(this);
endtask: run_phase*/


class test1 extends test;

`uvm_component_utils(test1)

extern function new (string name = "test1", uvm_component parent);
extern function void build_phase(uvm_phase phase);
extern task run_phase(uvm_phase phase);
endclass: test1

function test1::new(string name = "test1", uvm_component parent);
super.new(name,parent);
endfunction: new

function void test1::build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction: build_phase

task test1::run_phase(uvm_phase phase);
phase.raise_objection(this);
vseq=virsequence::type_id::create("vseq");

vseq.start(env.vseqrh);
phase.drop_objection(this);
endtask: run_phase

In reply to Nagabhushan:

Please use code tags. I have added them for you.

You are getting this error because uvm_config_db #(virtual interfa)::get() has failed. It needs to be set() before you can do a get(). But you usually you set() your virtual interface before calling run_test, then you assign it into your config object.