<< September 2015 | Home | November 2015 >>

Possible to crash WAS using System.out.println?

I've been pulling my hair out trying to diagnose an issue we've been having with the OnTime Group Calendar Social components that is the widgets we have for IBM Connections. After loads of frustration and lost time I've managed to find the issue and will document it here for the future and for Google.

The issue which appears on WebSphere Application Server ND v. 8.5.5.3 and 8.5.5.4 is caused by doing a simple System.out.println. This makes the server go bananas, throw a NullPointerException and make the JVM unstable and no longer reliable. Simply removing these System.out.println's seems to solve the problem. Now I know System.out.println should not be used and really they were left in my mistake in an embedded library. But they should hardly crash the JVM. The observed stacktrace is shown below. The System.out.println call appears on line 102 of dk.intravision.connections.FeedReader (in bold).

java.lang.NullPointerException
java.io.Writer.write(Writer.java:151)
java.io.BufferedWriter.newLine(BufferedWriter.java:236)
java.io.PrintStream.newLine(PrintStream.java:518)
java.io.PrintStream.println(PrintStream.java:670)
com.ibm.ejs.ras.StreamEvent6.writeDataToStream(StreamEvent6.java:205)
com.ibm.ejs.ras.StreamEvent6.writeSelfToStream(StreamEvent6.java:157)
com.ibm.ejs.ras.SystemStream.doPrintLine(SystemStream.java:800)
com.ibm.ejs.ras.SystemStream.println(SystemStream.java:703)
com.ibm.ejs.ras.SystemOutStream.println(SystemOutStream.java:80)
org.apache.felix.gogo.runtime.threadio.ThreadPrintStream.println(ThreadPrintStream.java:200)
org.apache.felix.gogo.runtime.threadio.ThreadPrintStream.println(ThreadPrintStream.java:200)
dk.intravision.connections.FeedReader.read(FeedReader.java:102)
dk.intravision.connections.profiles.Profile.getFollowingIDs(Profile.java:241)
dk.intravision.connections.profiles.Profile.getFollowingUsers(Profile.java:213)
...