Remote debugging Tomcat with Eclipse

When you’re running a Tomcat server on your own machine for development purposes, it’s pretty easy to tie it to Eclipse.  When that Tomcat instance (or, in my case, instances) are running as a service, without the benefit of the control panel, it gets a little harder.  Especially if it’s not a traditional web application, but a desktop app with a supporting web back-end.

Here’s how to debug a Tomcat server with Eclipse when it’s running as a service.  This example assumes that the server is at localhost, and that you’ll be debugging on port 5003 (your choice, so long as it’s available – and it can’t be the port that that Tomcat is already on).

Firstly, when you start your Tomcat service you need to pass a few additional options:

set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=5003

Next, the line that actually launches the service needs to pass those options in the JvmOptions parameter:

--JvmOptions "-XDebug;-Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n;-DJAVA_HOME=...

Important: no white-space in there.

Lastly, create the debug configuration in Eclipse:  Run -> Debug Configurations, add a new Remote  Tomcat Application.

  • Connection Type: Standard (Socket Attach)
  • Host: localhost
  • Port: 5003

Et viola, start this debug configuration to attach to the server, then launch your application as normal.


Obscure Ant build errors

I’ve been using Eclipse at work now, the first time I’ve done more than toy with it.  Along with Eclipse are the attendant tools – Ant, Maven, TomCat and ClearCase (oh yes, ClearCase).

So, Ant. I came across a situation where the build was failing to deploy the WAR files to TomCat, with the following error:

build.xml:887: java.net.UnknownHostException: C

Not much use there.  As it turns out, the solution was both simple and cripplingly unintuitive: replace “file://” with “file:///”.  The extra slash makes all the difference.

For example:

Replace:

war="file://${dist.dir}/app.war"

With:

war="file:///${dist.dir}/app.war"

Picsie updated to Alpha 1.3

Picsie has a minor new feature – a little UI improvement to make it easier to load more than one window at once.

When you load an image or video with Picsie, it checks to see if any other Picsie windows are open.  If not, it opens in the middle of the screen.  If Picsie is already running, it opens wherever Windows puts it, so it doesn’t cover the previous window.

Alpha 1.3 (7 July 2010)

  • Installer (~75KB).  This will set up your file associations for you.
  • Standalone .exe (~200KB).  Use this if you already have Picsie installed and you just want the latest version.  Just drop it over the existing one.

Read More →


New images: The Happy Collection

I made the first wallpaper in this set, Endorphin, during my final exams back at university.  Having my desktop looking so happy helped me keep a sense of proportion about the whole thing.

Thumbnail of the image Endorphin

Endorphin

Shortly after I posted it I got a request from a friend, who was also doing exams,  who wanted a new version – it was great, she said, but needed more pink.  And so “Happy Smarties” was born:

Thumbnail for the image Happy Smarties

Happy Smarties

Shortly after that a different friend wanted yet another version, this time for his multi-monitor setup.  So here’s the extreme widescreen version:

Thumbnail for the image Sense of Perspective

Sense of Perspective

This set always amused me, but I’m still surprised at the amount of traffic they got on my old website.

Creative Commons License These images are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


New Image: Redshift

When I first posted this image I had this niggling feeling it was very similar to one I’d seen elsewhere. Years later, I still get that feeling. Regardless, Redshift spends more time as my desktop wallpaper than anything else I’ve made.

Thumbnail of Redshift

Redshift

Creative Commons License
This image is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


New Image: Speed of Night

One of my earlier pictures I put together with Vue D’Esprit, and one of my favourites.

Thumbnail for Speed of Night image

Speed of Night

Creative Commons License
This image is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


Pictures

Flicking through site stats, I found out that the CG images I had on my old site actually got a fair few hits, so I’m going to sporadically upload them to this site over time, whenever I’m too busy and/or lazy to write an actual post.

The pictures are all either algorithmically generated, or composed with an old copy of Vue D’Esprit I got free with PC Format yonks ago.  As before, they are all available under a Creative Commons License (Attribution-NonCommercial-ShareAlike 3.0).


Picise updated to Alpha 1.2

A couple of quick fixes to Picsie.

Alpha 1.2 (20 June 2010)

  • Installer (~75KB).  This will set up your file associations for you.
  • Standalone .exe (~200KB).  Use this if you already have Picsie installed and you just want the latest version.  Just drop it over the existing one.

Read More →


LaTeX Includes

Latex offers a very nice way to divide large documents into manageable files – the include command.  Combined with the includeonly command you have a very powerful method of compiling your document.

Typically,  each included file is a chapter – this is apparently how it was designed, and is certainly how I – and every other LaTeX user I know – use it.  Today I decided that one chapter was far too big, and split it up into a few smaller files for easy management.  Took seconds, no problem.

Only later, when I was annotating a hard copy for my supervisor did I realise that every include finished with an implicit clearpage.  Just what you want when you’re starting a chapter, and so I’d never noticed it.  When you’re starting a new section though, that’s not what you want.

In this case, use the input command  – same format, same effect, but no implicit clearpage.  You lose the includeonly functionality, but it fixes your section breaks.

tldr/

Problem: Unwanted page breaks around include statements.

Solution:  Use the near-identical input command instead.


Unexpected LaTeX!

Somehow I forgot to mention that as well as delving into the world of C# I’m just finishing up my PhD thesis.  Having experienced the horrors of trying to manage a large document in Word, I set about learning to use LaTeX, which for this kind of work is superior in just about every imaginable way.

Once you decide on a style sheet, LaTeX pretty much manages everything for you, and lays it all out beautifully.  When it works, it works sublimely.  When it doesn’t work, you can really end up stuck.

So, I’m going to post a bunch of LaTeX problems too, since it can be really hard to find solutions when you don’t know the right vocabulary.