I have installed Oracle XE database on many machines and this seems to be a bug as I found which have to fix it manually on windows 7. I am not sure about if the problem exists on other platforms.
After install oracle XE everything is working as expected but once you restart your machine or database you cannot connect to it using TNS. Direct connection works but not when LISTENER is involved.
You might see following exceptions when connecting to database
IO Error: The Network Adapter could not establish the connection
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
For example look at the following slide
Connecting using SQL Command Line with and without using TNS
All you need to add XE database information to the LISTNER.ORA file typically found at C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
1. Add the XE database information to LISTENER.ORA file (Highlighted entries)
2. Restart the Listener from Services