Does this happen always Or only at the beginning only when you start hadoop?
If only at the beginning, then wait for sometime in order for NameNode to check if everything is okay before you access hdfs. If it's not leaving safemode after a considerable amount of time, that means there is some imbalance in the filesystem (e.g. under replicated or corrupted blocks). Under replicated blocks will be automatically balanced after some time. For corrupted blocks, you can have a look at output of this command:
hdfs fsck -list-corruptfileblocks
And try to delete corrupted blocks using:
hdfs fsck / -delete
If this does not help, as suggested by @Nishu, use hdfs dfsadmin -safemode leave
command to get NameNode out of safemode forcefully. Once you do so, check the output of hdfs dfsadmin -safemode get
to confirm that safemode is actually turned off.