2012-09-12 37 views
1

運行Mac(OS X 10.8.1)。我們已升級到最新的Java安全更新1.6.0_35-b10-428,此後我們的主應用程序不會在Eclipse中啓動。Java安全更新後使用SAXReader時出現StackOverFlowError

啓動Openfire 3.6.4時會引發以下異常。幾乎在openfire.xml配置解析時出現錯誤:

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 in thread "main" java.lang.StackOverflowError 
at java.nio.HeapByteBuffer.<init>(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(AbstractSAXParser.java:667) 
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.comment(XMLDTDValidator.java:978) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:479) 
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) 
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.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(AbstractSAXParser.java:1205) 
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.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.<init>(XMLProperties.java:114) 
at org.jivesoftware.util.XMLProperties.<init>(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.<init>(XMPPServer.java:163) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.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) 

編輯:新增Xss1m的建議,但同時應用得到了進一步我看到同樣的錯誤。這裏是我的啓動ARGS:

,這裏是我的啓動ARGS:

-DopenfireHome = 「$ {workspace_loc:Openfire的} /目標/ Openfire的」 -Djava.net.preferIPv4Stack =真-Xms32m -Xmx512m -Xss1m -XX: ThreadStackSize = 128 -XX:PermSize =72米-XX:MaxPermSize參數=96米-XX:+ PrintGCDetails -Xloggc:/tmp/gc.log -XX:+ HeapDumpOnOutOfMemoryError

EDIT2:

似乎以下修訂工作: 將-Xss128k修改爲-Xss1m並刪除-XX:ThreadStackSize = 128

回答

5

您是否嘗試增加堆棧大小?您可以通過在啓動JVM時指定-Xss1m來完成此操作。在這個例子中,JVM將爲每個線程分配1兆字節的堆棧。注意不要使用太大的值,因爲它會乘以應用程序中的線程數。

要在Eclipse中更改配置,請按照以下步驟操作(複製自here)。


開放爲您的應用運行配置(運行/運行配置...,然後查找在「Java應用程序」應用程序條目)。

參數選項卡具有文本框Vm參數,請輸入-Xss1m(或最大堆棧大小的較大參數)。默認值是512 kByte。


編輯:

它看起來就像是一個常見的問題。安全補丁可能引入了另一個調用鏈的方法,並且所有用於裝入堆棧的項目都不再適用。

+0

謝謝,它有點進一步,但一段時間後仍然顯示相同的錯誤。上面發佈了我的啓動參數。 –

+1

你可以嘗試沒有這個選項'-XX:ThreadStackSize = 128'恕我直言,它與'-Xss'選項衝突。另外爲了測試它,可以嘗試將'-Xss'設置爲更高的值,例如'-Xss10m',但是如果它與10Mb的堆棧崩潰,那麼可能會出現無限循環。 –

相關問題