Among these, it is provided: ???Only such persons may be licensed as are residents of this state and have been licensed insurance agents of this state for at least two years.??? The petitioner has complied, or offered to comply, with all the terms and conditions of the act, except those prescribed in the provision above quoted, and for his failure to comply with those his application was refused.