Spring + Camel:上下文初始化失败:java.lang.OutOfMemoryError:超出GC开销限制

时间:2016-01-18 14:34:29

标签: spring apache-camel

我在应用程序启动期间动态创建大约600个Camel CXF端点和路由。以这种方式创建端点时,我遇到了内存不足的问题。我需要在启动期间创建许多enpoints。 当我只创建一些它工作正常。问题是当我创建其中许多时。

CxfSpringEndpoint cxfEndpoint1 = new CxfSpringEndpoint();
        cxfEndpoint1.setAddress(address);
        cxfEndpoint1.setEndpointNamespace(namespace);
        cxfEndpoint1.setEndpointName(QName.valueOf(endpointPort));
        cxfEndpoint1.setServiceLocalName(serviceName);
        cxfEndpoint1.setWsdlURL(wsdl);
        cxfEndpoint1.setCamelContext(camelContext);
        cxfEndpoint1.setDataFormat(DataFormat.MESSAGE);
        camelContext.addEndpoint(entpointName1, cxfEndpoint1);

CxfSpringEndpoint cxfEndpoint2 = new CxfSpringEndpoint();
...

from(entpointName1)
                .to("log:input")
                .transform(body().regexReplaceAll("a", "b")) 
                .to(entpointName2)     
                .to("log:input");

我收到以下错误:

15:25:50,367 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-2) Context initialization failed: java.lang.OutOfMemoryError: GC overhead limit exceeded
at org.apache.xerces.util.SymbolTable$Entry.<init>(SymbolTable.java:400)
at org.apache.xerces.util.SymbolTable.addSymbol(SymbolTable.java:230)
at org.apache.xerces.impl.XMLEntityScanner.scanQName(XMLEntityScanner.java:614)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:129)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)
at org.apache.ws.commons.schema.XmlSchemaCollection$2.run(XmlSchemaCollection.java:749) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.XmlSchemaCollection$2.run(XmlSchemaCollection.java:747) [xmlschema-core-2.2.1.jar:]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_71]
at org.apache.ws.commons.schema.XmlSchemaCollection.parseDoPriv(XmlSchemaCollection.java:747) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:716) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:706) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:538) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1516) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:659) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:157) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:508) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:717) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:706) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:538) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1516) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:659) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:157) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:508) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:717) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:706) [xmlschema-core-2.2.1.jar:]
at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:538) [xmlschema-core-2.2.1.jar:]

Jboss配置:

 JAVA_OPTS: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xms1g -Xmx2500M -XX:MaxPermSize=512M

0 个答案:

没有答案