I found this: https://stackoverflow.com/questions/4832056/java-jdbc-how-to-connect-to-oracle-using-service-name-instead-of-sid.
But rebuilding the WAR each time to test a connection string is annoying. Do you have a JDBC client (like SqlWorkbench) that you an use a JAR to connect to the database? That way you can try out different URLs to see which works for you. From the article, the 2 styles are:
Or the TNS format:
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL=TCP)(HOST=blah.example.com)(PORT=1521)))(CONNECT_DATA=(SID=BLAHSID)(GLOBAL_NAME=BLAHSID.WORLD)(SERVER=DEDICATED)))
Also, confirm your port of 1521 is correct for your env, and there's no firewall blocking connections. You'll be able to determine this more easily if you get the JDBC client and use it to test your JDBC urls.
I've just set up Oracle XE myself, and this worked for me:
And in SqlDeveloper (Oracle's tool) I did specify to connect via the 'Servcie Name'...So without further information, I'm not sure where your problem is.