Sunday, 21 October 2012

The Bree Louise

The Bree Louise pub at Euston is a place I've walked past many a time, but never ventured into. Normally I'm heading for Diwana around the corner in Drummond St. a veggie restaurant from the era when veggie resturants where few and far between.  The other day I was heading for the Bree Louise to meet a friend, who as it turned out didn't show up while I was there. I did find a spaniard and an american to talk to though, so not all was lost! And the pub, a dusty, old-school pub with fantastic selection of ales. recommend : )

I finally decided enough was enough today and I'd put my mind to getting Tomcat debugging to work in IntelliJ, something I've always meant to do, just never got round to.

Firstly I needed need to get Tomcat Server to show up in Run/Debug Configurations and Application servers to show up in Settings > IDE Settings . It wasn't there so I went to Settings > Pluggins and and enabled Tomcat integration. After the IDE restarted I added my Tomcat to the Applications Servers section by opening Settings > Application Servers > Add, it asked me for my Tomcat home and base directories ("tomcat home" where the bin is and "tomcat base" is where the "webapps" directory is, on my deployment the conf director was in base location and IntelliJ was expecting it to be in home, so I had to symlink it in).

Then selected the Run/Debug Configurations menu, clicked Add, selected Tomcat server (local in my case), give it a name and leave the defaults as they are.

I needed to create an artifact in Project Structure to link to my tomcat webapp. This was a simple task of choosing Add >Web Application Exploded an adding the source folders.

I needed to tweak some stuff to get tomcat to play nicely, IntelliJ wanted to start tomcat by running ./catalina.sh run, starting tomcat this way was giving me Tomcat – Java.Lang.OutOfMemoryError: PermGen Space error, in the end I added this to the catalina.sh file
JAVA_OPTS="-Xms536m -Xmx1024m -XX:PermSize=256m 
-XX:MaxPermSize=256m $JAVA_OPTS"
probably not the best way of doing things, but it did sort out my start up issues!
All this required a lot of starting tomcat, a quick way to find tomcat process id in order to kill it (presuming your running on 8080)
$ sudo netstat -lpn |grep :8080
tcp6  0  0   :::8080    :::*   LISTEN   6447/java
$ kill 6447 
or  $ kill -9 [proc id] if your hard core!

Anyway, debugging is now working, I haven't explored all the options but did check the "persist sessions" checkbox which means you can pick up where you left off between restarts which is magic! And, hot swapping seems to work (on occasion).

Why didn't I get this sorted ages ago?!




No comments:

Post a Comment

 

Note: the opinions on this page don't represent that of my employer in anyway. And, actually only vaguely represent my opinions on the date of publication. (Unlike Ms T, I am very much for turning)