Monday, December 3, 2012

Launching a GWT Demo with IntelliJ IDEA

It's been a while since I worked with GWT. I did it for a pet project, when I was into all the databases stuff. It was about database normalization. You know, to avoid redundancies, which of course you denormalize when you copy your entities to Lucene or a NoSQL database. But this post isn't about that.

I wanted to start a simple GWT project. Copying the one in the tutorial. So I launched my new IDEA Ultimate environment (those $100 have to pay off), which has built-in GWT support. This has to take only a few minutes I thought. Right...

First, I wanted to run the project in production mode, deploying it to a Tomcat 6. It said the deploy was successful, yet nothing was there. I checked Catalina Home, Catalina Base, all those variables. After hours I decided to remove the Tomcat folder and create a new one, so I downloaded it again from the Apache site, unzipped it, and set it up in IDEA. Then I checked with great detail all files in conf, that everything was there, and suddenly, it worked. What happened? Only deity knows...

So, now let's make it run in dev mode. I read about a new mode in GWT 2.5: "Super Dev Mode" and IDEA suports it. Let's try it.

Well, supposedly it runs a compiler server and you add bookmarks links so when you work on your GWT page, you can rebuild your javascript code "on the fly". But where was my GWT page? It certainly didn't work with my app that was running on Tomcat (in production mode). I guess Super Dev Mode needs more polishing.

Let's try the old and tested "Classic" Dev Mode. It started successfully. Now I need to install the GWT plugin for Chrome. Easy you say? Nahh.. It seems that this plugin is not supported (at least yet) if you run Chrome on Windows 8 (or Server 2012, in my case). Why? Well, people are complaining in the forums. After being defeated once more, I downloaded and installed Firefox. Aha! It seems that there is no official GWT extension for Firefox. Luckily there was an unofficial one and it seemed to work.

So this was the status of a little GWT demo which was supposed to be running in minutes but took me hours. Now at least I can start adding more widgets and panels. I hope I can run the GWT plugin for Chrome again without resorting to virtual machines.

As usual, thanks to StackOverflow for helping me finding some answers, or at least people that had the same questions.

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.