Download PingPlotter and turn it on (leave it running for 24 hours or so). Watch the historical graph, you'll likely find the IP address dropping or response times going through the roof at the same time your app can't connect to Oracle. You don't have a logic error, either the server is drastically overloaded, or you've got major congestion between you and it. Are you connecting through a VPN?
Or just use ping from the command line in continuous mode for an hour or so:
ping -t <IP address or hostname>
Ping plotter doesn't ping as often and it creates nice graphs.
If you are working remotely, then it could be your ISP. Otherwise, talk to the network administrator or the DBA.
Obviously you can't go into production with a poor DB connection, so hopefully you just see this issue from your development environment. Try deploying to the machine where you plan to run the application eventually and see if it improves.
If there is nothing you can do to make it better, I recommend increasing your initial login timeout for your JDBC driver.
Google JDBC setLoginTimeout
Here is an example, although there are several ways to go about it, depending on your driver.