I found some reasons for this exception.they are
1)The name of the database XE by default.so the url will be"jdbc:oracle:thin:@localhost:1521:XE".
2)Make sure that OracleServiceXE,OracleXETNSListener is running.it will be in Control Panel\All Control Panel Items\Administrative Tools\Services