Thursday, September 6, 2012

Oracle Database XE listening port

I installed an instance of Oracle Database XE (version 11g) at my home machine. The idea was to connect an (also Oracle) Glassfish server to it. So, I start the server, and bam! Port 8080 is busy. By whom? I wonder, if the last time I was using this computer, I started a Tomcat server successfully.

Well, what do you know, there was a service installed by the Oracle Database that decided to occupy that port. Its name was something like Oracle listener. So I shut it down. Now Glassfish works fine.

I configure the datasource using Glassfish Admin Tool. I set everything, but it complains that it cannot connect to the database. I wonder again, because I had a Oracle SQL Developer open and connected to the database, and everything was working fine there.

After revising the parameters for the millonth time (having OracleDataSource Javadoc at hand on a separate browser tab), I decide to close the SQL Developer connection and reopen it. Aha! It cannot establish a connection. Then the light bulb turns on, and I decide to restart that service, but with Glassfish running so it cannot claim the 8080 port. It starts fine. At first I still cannot connect, this time complaining that the SID is wrong, but after a minute, the database accepts the SID, I can connect the SQL Developer again to the database, I can also connect my JDBC Datasource (in Glassfish) to the Database... and we all rejoice.

No comments: