powered by Jive Software

StackOverflowError after Java security update

Running a Mac (OS X 10.8.1). We were upgraded to the latest Java security update 1.6.0_35-b10-428 and since then our main app doesn’t launch in Eclipse.

The Exception below is thrown when starting up Openfire 3.6.4. Pretty much where the openfire.xml config is parsed is when the error occurs:

private void buildDoc(Reader in) throws IOException {

try {

SAXReader xmlReader = new SAXReader();

xmlReader.setEncoding(“UTF-8”);

document = xmlReader.read(in);

}

catch (Exception e) {

Log.error(“Error reading XML properties”, e);

System.out.println(“NOOO”);

e.printStackTrace();

throw new IOException(e.getMessage());

}

finally {

if (in != null) {

in.close();

}

}

}

Exception thrown:

Exception in thread “main” java.lang.StackOverflowError

at java.nio.HeapByteBuffer.(HeapByteBuffer.java:52)

at java.nio.ByteBuffer.wrap(ByteBuffer.java:350)

at java.nio.ByteBuffer.wrap(ByteBuffer.java:373)

at java.lang.StringCoding$StringEncoder.encode(StringCoding.java:237)

at java.lang.StringCoding.encode(StringCoding.java:272)

at java.lang.String.getBytes(String.java:946)

at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)

at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:228)

at java.io.File.exists(File.java:733)

at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:999)

at sun.misc.URLClassPath.getResource(URLClassPath.java:169)

at java.net.URLClassLoader$1.run(URLClassLoader.java:194)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at org.dom4j.DocumentFactory.createDocument(DocumentFactory.java:102)

at org.dom4j.DocumentFactory.createDocument(DocumentFactory.java:122)

at org.dom4j.io.SAXContentHandler.createDocument(SAXContentHandler.java:830)

at org.dom4j.io.SAXContentHandler.getDocument(SAXContentHandler.java:164)

at org.dom4j.io.SAXContentHandler.comment(SAXContentHandler.java:428)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.comment(AbstractSA XParser.java:667)

at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.comment(XMLDTDValid ator.java:978)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocu ment(XMLDocumentFragmentScannerImpl.java:479)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Config uration.java:808)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Config uration.java:737)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXP arser.java:1205)

at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXPa rserImpl.java:522)

at org.dom4j.io.SAXReader.read(SAXReader.java:465)

at org.dom4j.io.SAXReader.read(SAXReader.java:365)

at org.jivesoftware.util.XMLProperties.buildDoc(XMLProperties.java:471)

at org.jivesoftware.util.XMLProperties.(XMLProperties.java:114)

at org.jivesoftware.util.XMLProperties.(XMLProperties.java:63)

at org.jivesoftware.util.JiveGlobals.loadSetupProperties(JiveGlobals.java:832)

at org.jivesoftware.util.JiveGlobals.getXMLProperty(JiveGlobals.java:282)

at org.jivesoftware.util.JiveGlobals.isSetupMode(JiveGlobals.java:791)

at org.jivesoftware.util.JiveGlobals.getProperty(JiveGlobals.java:529)

at org.jivesoftware.openfire.XMPPServer.initialize(XMPPServer.java:300)

at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:419)

at org.jivesoftware.openfire.XMPPServer.(XMPPServer.java:163)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at java.lang.Class.newInstance0(Class.java:355)

at java.lang.Class.newInstance(Class.java:308)

at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:106)

at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:51)

Installed a previous JDK from Apple’s Developer site and selected that in Eclipse. All’s well now.

Alternatively amending the Openfire args as below also works:

Initial startup args:

-DopenfireHome="${workspace_loc:openfire}/target/openfire" -Djava.net.preferIPv4Stack=true -Xms32m -Xmx512m -Xss1m -XX:ThreadStackSize=128 -XX:PermSize=72m -XX:MaxPermSize=96m -XX:+PrintGCDetails -Xloggc:/tmp/gc.log -XX:+HeapDumpOnOutOfMemoryError

Below amendments work:

amending -Xss128k to -Xss1m and removing -XX:ThreadStackSize=128