Hudson: java.lang.OutOfMemoryError: Java heap space error

运行hudson时,运用cobertura产生coverage reports,每当运行到最后都会报:
[color=red]FATAL: Java heap space
java.lang.OutOfMemoryError: Java heap space[/color]
对在Hudson平台上运行的job下的Java Options对应处加上-Xms128m -Xmx512m条件,问题依然得不到解决。("-Xms128m -Xmx512m"?)

ant script:
<?xml version="1.0"?>
<project name="GEHGUIUT" default="all" basedir=".">

<!-- Dir of the ant properties file -->
<property name="ant.properties.dir" value="."/>

<!-- put in the properties. -->
<property file="${ant.properties.dir}/ant_ut.properties"/>
<property name="testclassname" value="*"/>

<path id="src.classpath">
<pathelement location="${tpcl}/OlderVersions/struts.jar"/>
<pathelement location="${tpcl}/OlderVersions/weblogic.jar"/>
<pathelement location="${tpcl}/icjava621.jar"/>
<pathelement location="${tpcl}/tibrvj.jar"/>
<pathelement location="${tpcl}/tibrjms.jar"/>
<pathelement location="${tpcl}/log4j-1.2.8.jar"/>
<pathelement location="${tpcl}/xml-apis.jar"/>
<pathelement location="${tpcl}/xercesImpl.jar" />
<pathelement location="${tpcl}/castor-0.9.7-xml.jar"/>
<pathelement location="${tpcl}/jgroups-all.jar"/>
<pathelement location="${tpcl}/saaj.jar"/>
<pathelement location="${tpcl}/axis-ant.jar"/>
<pathelement location="${tpcl}/commons-discovery-0.2.jar"/>
<pathelement location="${tpcl}/jaxrpc.jar"/>
<pathelement location="${tpcl}/axis.jar"/>
<pathelement location="${tpcl}/wsdl4j-1.5.1.jar"/>
<pathelement location="${tpcl}/xalan.jar"/>
<pathelement location="${tpcl}/joda-time-1.5.2.jar"/>
</path>

<path id="test.classpath">
<fileset dir="${tpcl}/utest">
<include name="junit-4.6.jar"/>
<include name="mock.jar"/>
<include name="ojdbc14.jar"/>
</fileset>
<fileset dir="${tpcl}">
<include name="commons-collections.jar"/>
<include name="commons-dbcp-1.1.jar"/>
<include name="commons-pool-1.1.jar"/>
<include name="jms.jar"/>
</fileset>
</path>

<path id="cobertura.classpath">
<fileset dir="${tpcl}/utest/cobertura">
<include name="*.jar" />
</fileset>
<path refid="src.classpath"/>
<path refid="test.classpath"/>
</path>

<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<!-- Delete all directories -->
<target name="cleanup">
<tstamp/>
<delete dir="${builddir}"/>
<!--delete dir="${javadoc}"/ -->
</target>


<!-- Create directories -->
<target name="init" depends="cleanup">
<tstamp/>
<mkdir dir="${builddir}"/>
<!--mkdir dir="${javadoc}"/ -->
</target>

<target name="inittest">
<delete dir="${testdir}" />
<mkdir dir="${testdir}" />
<mkdir dir="${testdir}/reports/junitxml" />
<mkdir dir="${testdir}/reports/junithtml" />
<mkdir dir="${testdir}/reports/coveragexml" />
<mkdir dir="${testdir}/reports/coveragehtml" />
</target>

<!-- Generate javadoc -->
<target name="javadoc" depends="init">
<delete dir="${javadoc}"/>
<javadoc packagenames="com.zw.geh.*" author="true" use="true" version="true" sourcepath="${source.web};${source.ejb}" destdir="${javadoc}">
<classpath>
<pathelement location="${tpcl}/struts.jar" />
<pathelement location="${tpcl}/castor-0.9.7-xml.jar" />
<pathelement location="${tpcl}/jms.jar" />
<pathelement location="${tpcl}/xercesImpl.jar" />
<pathelement location="${tpcl}/icjava621.jar"/>
</classpath>
</javadoc>
</target>

<!-- Compile common, EJB and Web module code -->
<target name="compile" depends="init">
<tstamp/>
<javac srcdir="${source.ejb};${source.web};${source.common};${source.workflow};" encoding="ISO-8859-1" destdir="${builddir}" debug="yes">
<classpath refid="src.classpath"/>
</javac>
</target>

<target name="compiletestcode" depends="inittest,compile">
<javac srcdir="${utestdir}/java;" destdir="${testdir}" debug="yes" >
<classpath refid="src.classpath" />
<classpath refid="test.classpath" />
<classpath>
<pathelement location="${builddir}"/>
</classpath>
</javac>
</target>

<target name="copyGlobalLocalResource" depends="compiletestcode">
<copy todir="${builddir}">
<fileset dir="${utestdir}/GlobalEnvironment/China">
<include name="GlobalEnvProperties.properties"/>
</fileset>
</copy>
</target>

<target name="copyGlobalUSResource" depends="compiletestcode">
<copy todir="${builddir}">
<fileset dir="${utestdir}/GlobalEnvironment/US">
<include name="GlobalEnvProperties.properties"/>
</fileset>
</copy>
</target>

<target name="copyResource" depends="compiletestcode">
<copy todir="${builddir}">
<fileset dir="${utestdir}/resources">
<include name="**/*.properties" />
<include name="**/*.sql" />
</fileset>
<fileset dir="${source.web}">
<include name="**/*.properties"/>
<include name="**/*.xslt"/>
</fileset>
<fileset dir="${web.inf.dir}">
<include name="**/server-config.wsdd"/>
</fileset>
<fileset dir="${web.inf.dir}/../">
<include name="**/GEHlog4j.properties"/>
</fileset>
<fileset dir="${config.dir}">
<include name="**/DatabaseType.properties"/>
<include name="**/SQLHelper.properties"/>
</fileset>
<fileset dir="${config.dir}/Oracle">
<include name="**/DatabaseEscapeCharacters.properties"/>
</fileset>
</copy>
<copy file="../ant/gehAppVersion.properties" tofile="${builddir}/com/zw/geh/gehAppVersion.properties"/>
</target>
<!-- this part is for unit test and coverage -->

<target name="instrument">
<cobertura-instrument todir="${instrumenteddir}">
<!--
The following line causes instrument to ignore any
source line containing a reference to log4j, for the
purposes of coverage reporting.
-->
<ignore regex="org.apache.log4j.*" />

<fileset dir="${builddir}">
<exclude name="**/rv/**/*.class"/>
<exclude name="**/*Test.class"/>
</fileset>
</cobertura-instrument>
</target>

<target name="test">
<junit dir="./" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
<!--
Note the classpath order: instrumented classes are before the
original (uninstrumented) classes. This is important.
-->
<classpath location="${instrumenteddir}" />
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<classpath location="${builddir}" />
<classpath location="${testdir}" />

<!--
The instrumented classes reference classes used by the
Cobertura runtime, so Cobertura and its dependencies
must be on your classpath.
-->
<classpath refid="cobertura.classpath" />

<formatter type="brief" usefile="false"/>
<formatter type="xml" />
<test name="${testcase}" todir="${reportsdir}/junitxml" if="testcase" />
<batchtest todir="${reportsdir}/junitxml" unless="testcase">
<fileset dir="${utestdir}/java">
<include name="**/${testclassname}Test.java" />
<exclude name="**/rv/**/*.java"/>
</fileset>
</batchtest>
</junit>

<junitreport todir="${reportsdir}/junitxml">
<fileset dir="${reportsdir}/junitxml">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${reportsdir}/junithtml" />
</junitreport>
</target>

<target name="coverage-check">
<cobertura-check branchrate="34" totallinerate="100" />
</target>

<target name="coverage-report">
<!--
Generate an XML file containing the coverage data using
the "srcdir" attribute.
-->
<cobertura-report srcdir="${source.ejb};${source.web};" destdir="${reportsdir}/coveragexml" format="xml" />
</target>

<target name="alternate-coverage-report">
<!--
Generate a series of HTML files containing the coverage
data in a user-readable form using nested source filesets.
-->
<cobertura-report destdir="${reportsdir}/coveragehtml">
<fileset dir="${source.ejb}">
<include name="**/*.java" />
</fileset>
<fileset dir="${source.web}">
<include name="**/*.java" />
</fileset>
<!--
<fileset dir="${source.common}">
<include name="**/*.java" />
</fileset>
<fileset dir="${source.workflow}">
<include name="**/*.java" />
</fileset>
-->
</cobertura-report>
</target>

<target name="cleanupJMSForUSMachine">
<echo message="cleanJMS"/>
<exec executable="/apps/tibco/ems/5.0/bin/cleanupJMSForUTLocal.sh"/>
<echo message="clean up jms successful"/>
</target>

<target name="cleanupJMSForLocalMachine">
<echo message="cleanJMS"/>
<exec executable="cleanupJMSForWindows.bat"/>
<echo message="clean up jms successful"/>
</target>

<target name="cleanGEHDB">
<echo message="cleanGEHDB"/>
<ant antfile="build-cleandatabase.xml" target="cleanupGEH"/>
</target>
<target name="cleanGALDB">
<echo message="cleanGALDB"/>
<ant antfile="build-cleandatabase.xml" target="cleanupGAL"/>
</target>
<target name="cleanGEHDBUS">
<echo message="cleanGEHDB"/>
<ant antfile="build-cleandatabase.xml" target="cleanupGEHUS"/>
</target>
<target name="cleanGALDBUS">
<echo message="cleanGALDB"/>
<ant antfile="build-cleandatabase.xml" target="cleanupGALUS"/>
</target>
<!-- Build script section -->
<target name="all" depends="cleanGEHDB,copyGlobalLocalResource,copyResource,instrument,test,coverage-report,alternate-coverage-report,cleanupJMSForLocalMachine"/>
<target name="US" depends="cleanGEHDBUS,copyGlobalUSResource,copyResource,instrument,test,coverage-report,alternate-coverage-report,cleanupJMSForUSMachine"/>
</project>


<?xml version="1.0"?>
<project default="all" basedir=".">

<!-- Dir of the ant properties file -->
<property name="ant.properties.dir" value="."/>

<!-- put in the properties. -->
<property file="${ant.properties.dir}/ant_ut.properties"/>

<path id="src.classpath">
<fileset dir="${tpcl}/utest">
<include name="ojdbc14.jar" />
</fileset>
</path>

<target name="loadGlobalProperties_China" description="load global properties(China)">
<!-- Pull in China related environmental properties UT may need -->
<property file="${utestdir}/GlobalEnvironment/China/GlobalEnvProperties.properties" />
</target>
<target name="loadGlobalProperties_US" description="load global properties(US)">
<!-- Pull in US related environmental properties UT may need -->
<property file="${utestdir}/GlobalEnvironment/US/GlobalEnvProperties.properties" />
</target>

<target name="cleanupGAL" depends="loadGlobalProperties_China" description="clean db">
<sql driver="${GALGUI.UT.DB.DRIVERNAME}" url="${GALGUI.UT.DB.URL}" password="${GALGUI.UT.DB.PASSWORD}" userid="${GALGUI.UT.DB.USERNAME}" encoding="utf8" print="no">
<transaction src="${clean.GAL.sqlfile.name}"/>
<classpath refid="src.classpath" />
</sql>
</target>

<target name="cleanupGALUS" depends="loadGlobalProperties_US" description="clean db">
<sql driver="${GALGUI.UT.DB.DRIVERNAME}" url="${GALGUI.UT.DB.URL}" password="${GALGUI.UT.DB.PASSWORD}" userid="${GALGUI.UT.DB.USERNAME}" encoding="utf8" print="no">
<transaction src="${clean.GAL.sqlfile.name}"/>
<classpath refid="src.classpath" />
</sql>
</target>

<target name="cleanupGEH" depends="loadGlobalProperties_China" description="clean db">
<sql driver="${GEHGUI.UT.DB.DRIVERNAME}" url="${GEHGUI.UT.DB.URL}" password="${GEHGUI.UT.DB.PASSWORD}" userid="${GEHGUI.UT.DB.USERNAME}" encoding="utf8" print="no">
<transaction src="${clean.GEH.sqlfile.name}"/>
<classpath refid="src.classpath" />
</sql>
</target>

<target name="cleanupGEHUS" depends="loadGlobalProperties_US" description="clean db">
<sql driver="${GEHGUI.UT.DB.DRIVERNAME}" url="${GEHGUI.UT.DB.URL}" password="${GEHGUI.UT.DB.PASSWORD}" userid="${GEHGUI.UT.DB.USERNAME}" encoding="utf8" print="no">
<transaction src="${clean.GEH.sqlfile.name}"/>
<classpath refid="src.classpath" />
</sql>
</target>
</project >


对jsvc自启动的tomcat脚本,增加[color=violet]CATALINA_OPTS="-Xms128m -Xmx512m"[/color],问题得到解决。
#!/bin/sh
#
# Startup Script for Tomcat6
#
# chkconfig: 345 88 18
# description: Tomcat Daemon
# processname: jsvc
# pidfile: /usr/var/run/jsvc.pid
# config:
#
# Source function library.
. /etc/rc.d/init.d/functions
#
prog=tomcat
#
# Adapt the following lines to your configuration
JAVA_HOME=/usr/java/jdk1.5.0_18
CATALINA_HOME=/apps/apache-tomcat-6.0.16
DAEMON_HOME=$CATALINA_HOME/bin/jsvc-src
TOMCAT_USER=your username(Linux下启动tomcat的用户)
HUDSON_HOME=/apps/hudson_gal_geh

# for multi instances adapt those lines.
TMP_DIR=/var/tmp
PID_FILE=/var/run/jsvc.pid
CATALINA_BASE=/apps/apache-tomcat-6.0.16

CATALINA_OPTS="-Xms128m -Xmx512m"
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar

case "$1" in
start)
#
# Start Tomcat
#
$DAEMON_HOME/jsvc \
-user $TOMCAT_USER \
-home $JAVA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Dcatalina.base=$CATALINA_BASE \
-DHUDSON_HOME=$HUDSON_HOME \
-Djava.io.tmpdir=$TMP_DIR \
-wait 10 \
-pidfile $PID_FILE \
-outfile $CATALINA_HOME/logs/catalina.out \
-errfile '&1' \
$CATALINA_OPTS \
-cp $CLASSPATH \
org.apache.catalina.startup.Bootstrap
#
# To get a verbose JVM
#-verbose \
# To get a debug of jsvc.
#-debug \
exit $?
;;

stop)
#
# Stop Tomcat
#
$DAEMON_HOME/jsvc \
-stop \
-pidfile $PID_FILE \
org.apache.catalina.startup.Bootstrap
exit $?
;;

*)
echo "Usage tomcat.sh start/stop"
exit 1;;
esac


<tstamp />
<zipfileset dir="${web}" prefix="WEB-INF">
<include name="**/*.xml"/>
<include name="**/*.java"/>
<exclude name="web.xml"/>
</zipfileset>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ERROR: Launching agent process aborted. Also: java.lang.Throwable: launched here at hudson.slaves.SlaveComputer._connect(SlaveComputer.java:287) at hudson.model.Computer.connect(Computer.java:447) at hudson.slaves.SlaveComputer.tryReconnect(SlaveComputer.java:854) at hudson.slaves.RetentionStrategy$Always.check(RetentionStrategy.java:173) at hudson.slaves.RetentionStrategy$Always.check(RetentionStrategy.java:161) at hudson.slaves.ComputerRetentionWork$1.run(ComputerRetentionWork.java:71) at hudson.model.Queue._withLock(Queue.java:1397) at hudson.model.Queue.withLock(Queue.java:1271) at hudson.slaves.ComputerRetentionWork.doRun(ComputerRetentionWork.java:62) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:92) at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:67) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) java.lang.InterruptedException: Validate configuration: The Host must be specified The selected credentials cannot be found at hudson.plugins.sshslaves.SSHLauncher.checkConfig(SSHLauncher.java:925) at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:411) at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:298) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值