小编典典

在Java堆空间异常上运行Cucumber测试后,Jenkins构建失败

jenkins

使用Jenkins进行构建时出现以下异常。运行Cucumber测试后会引发此异常。

谁能说出Java堆空间上失败的确切位置?

您有什么办法可以解决吗?

一些背景:在Cucumber测试期间我有一个Java堆空间,在增加内存后,Cucumber测试通过了,但是我在此之后立即得到了这个Java堆空间。

谢谢,

骗子

mojoSucceeded org.apache.maven.plugins:maven-surefire-plugin:2.9(default-test)
[JENKINS] Recording test results
mavenExecutionResult exceptions not empty
message : Java heap space
Stack trace : 
java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Arrays.java:3209)
    at java.lang.String.<init>(String.java:215)
    at com.sun.org.apache.xerces.internal.xni.XMLString.toString(XMLString.java:185)
    at com.sun.org.apache.xerces.internal.util.XMLAttributesImpl.getValue(XMLAttributesImpl.java:537)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$AttributesProxy.getValue(AbstractSAXParser.java:2319)
    at org.dom4j.tree.AbstractElement.setAttributes(AbstractElement.java:543)
    at org.dom4j.io.SAXContentHandler.addAttributes(SAXContentHandler.java:916)
    at org.dom4j.io.SAXContentHandler.startElement(SAXContentHandler.java:249)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    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:264)
    at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:112)
    at hudson.tasks.junit.TestResult.parse(TestResult.java:227)
    at hudson.tasks.junit.TestResult.parse(TestResult.java:163)
    at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:141)
    at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:421)
    at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:403)
    at org.jfrog.build.extractor.maven.BuildInfoRecorder.mojoSucceeded(BuildInfoRecorder.java:241)
    at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87)
    at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:228)
channel stopped

阅读 277

收藏
2020-07-25

共1个答案

小编典典

进入Jenkins设置并将环境变量添加MAVEN_OPTS到中-Xmx512m -XX:MaxPermSize=256m。测试完成后,似乎正在尝试解析结果,但XML文件太大。

2020-07-25