Daniel Harrison's Personal Blog

Personal blog for daniel harrison

Embedded Tomcat 5.5 and Java 1.6 PSA November 27, 2007

Filed under: development — danielharrison @ 12:28 pm

Just a public service announcement, my guess is this particular circumstance will be pretty rare.

If you’ve been running embedded tomcat under a wrapper class you might have some problems when you go to java 1.6 and you watch stdin and stdout.

We ran an embedded instance in our application with a wrapper that communicates via stdin and stdout to our controlling application, piping if you will. It appears that unless you define a root logger the embedded instance will redirect stdout to a null output handler which means you no longer get output. This will mean if you’re writing status outputs to which another application is listening to it will appear to just stop.

try {
    FileHandler fileHandler = new FileHandler(File.createTempFile("embedded-tomcat", ".log").getAbsolutePath(), true);
    fileHandler.setFormatter(new SimpleFormatter());
} catch (IOException e) {

Also under java 1.6, make sure you redirect standard in when invoking java from a .net 2 process. This previously worked under 1.5 but probably shouldn’t have. My guess is java 1.6 ‘fixed’ a lot of stdin, out stream which meant coincidental behaviour that previously worked no longer does.

See http://www.mail-archive.com/users@tomcat.apache.org/msg36244.html for a thread where someone else was having a similar problem.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s