运行Mac(OS X 10.8.1)。我们升级到最新的Java安全更新1.6.0_35-b10-428,从那时起,我们的主应用程序无法在Eclipse中启动。
启动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:
-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
EDIT2:
似乎以下修正工作: 修改-Xss128k到-Xss1m并删除-XX:ThreadStackSize = 128
答案 0 :(得分:5)
您是否尝试增加堆栈大小?您可以通过在启动JVM时指定-Xss1m
来执行此操作。在示例中,JVM将为每个线程分配1兆字节的堆栈。注意不要使用太大的值,因为它将乘以应用程序中的线程数。
要在Eclipse中更改配置,请按照以下步骤操作(从here复制)。
打开应用程序的运行配置(运行/运行配置...,然后在'Java应用程序'中查找应用程序条目)。
参数选项卡有一个文本框Vm参数,输入-Xss1m(或最大堆栈大小的更大参数)。默认值为512 kByte。
编辑:
看起来这是一个常见问题。安全补丁可能引入了对链的另一个方法调用,并且以前适合堆栈的所有项目都不再适合。