问题描述
当使用Jenkins构建时,我得到以下异常。这个异常在运行Cucumber测试之后引发。
任何人都可以告诉在java堆空间上失败的确切位置。
一些背景:我在Cucumber测试期间有一个java堆空间,在我增加了内存,Cucumber测试通过,但我得到这个java堆空间后。
感谢,
mojoSucceeded org.apache.maven.plugins:maven-surefire-plugin:2.9(default-test)
[JENKINS ]记录测试结果
mavenExecutionResult异常不为空
消息:Java堆空间
堆栈跟踪:
java.lang.OutOfMemoryError:Java堆空间
在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。 com.sun.org上的com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
中的XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
。 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。 repoers.SurefireArchiver.postExecute(SurefireArchiver.java:141)
at hudson.maven.Maven3Builder $ MavenExecutionListener.recordMojoEnded(Maven3Builder.java:421)
at hudson.maven.Maven3Builder $ MavenExecutionListener.mojoSucceeded(Maven3Builder。 java:403)
在org.jfrog.build.extractor.maven.BuildInfoRecorder.mojoSucceeded(BuildInfoRecorder.java:241)
在org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult。 java:87)
在org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor。 java:228)
通道停止
进入Jenkins设置,并将环境变量 MAVEN_OPTS
添加到 -Xmx512m -XX:MaxPermSize = 256m
。看起来像你的测试完成后,它试图解析结果,但XML文件太大。
I get following exception when building using Jenkins. This exception raises after running Cucumber tests.
Can anyone tell the exact spot that fails on the java heap space?
Do you have any idea what can be done in order to solve it?
Some background: I had a java heap space during the Cucumber tests, after I increased the memory, Cucumber tests pass, but I get this java heap space right after.
Thanks,
Lior
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
Go into the Jenkins settings and add the environment variable MAVEN_OPTS
to -Xmx512m -XX:MaxPermSize=256m
. It looks like after your tests are finished it's trying to parse the results but the XML file is too large.
这篇关于对Java堆空间异常运行Cucumber测试后,Jenkins构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!