`
qtlkw
  • 浏览: 308486 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

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

阅读更多
运行hudson时,运用cobertura产生coverage reports,每当运行到最后都会报:
FATAL: Java heap space
java.lang.OutOfMemoryError: Java heap space

对在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脚本,增加CATALINA_OPTS="-Xms128m -Xmx512m",问题得到解决。
#!/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>  
      
分享到:
评论
2 楼 qtlkw 2012-09-24  
slave没玩过
1 楼 wuliupo 2012-07-30  
如果我的是 slave 机器,怎么设置呢?

相关推荐

    hudson插件加载失败解决方案.pdf

    hudson是一个基于Java的开源持续集成工具,能够自动化构建、测试和部署过程。本文档使用的hudson版本为hudson-2.2.1.war,该版本在Windows XP环境下运行。 二、环境信息 环境:Windows XP 本文档使用的环境为...

    hudson.model.UpdateCenter.xml

    解决jenkins安装时提示离线问题

    Hudson ver. 1.395.1

    Hudson ver. 1.395.1 Hudson ver. 1.395.1 官网下载速度太慢了,好不容易找到一个,自己先收起来~

    hudson.plugins.nodejs.tools.NodeJSInstaller 版本最高为17.9.0

    用于解决jenkins安装nodeJs插件后不能选择nodejs版本,将该文件上传到服务器,然后 docker cp ./hudson.plugins.nodejs.tools.NodeJSInstaller 容器ID:/var/jenkins_home/updates 然后重启Jenkins

    hudson.rar

    hudson.rarhudson.rarhudson.rarhudson.rarhudson.rar

    hudson.plugins.nodejs.tools.NodeJSInstaller

    jenkins的nodejs12.8插件,在jenkins版本太老,不能更新插件时使用,上传文件到linux进入/root/.jenkins/updates/,重启jenkins即可。

    hudson-3.3.1.war

    his release of Hudson is built against Java 7 and no longer supports running Hudson itself on Java 5 or 6. You can of course still use Hudson to manage jobs that compile against these earlier versions...

    hudson-2.x:Hudson 2.x CI服务器。 Hudson 3.x可从https:git.eclipse.orgchudson获得

    哈德逊(Hudson)是一款开源的持续集成服务器,它被广泛用于自动化各种构建、测试和部署任务,特别是在Java开发环境中。"hudson-2.x"指的是哈德逊的2.x版本系列,这是一个重要的里程碑,因为哈德逊在此版本中引入了...

    hudson-3.2.2.war

    hudson-3.2.2 放在tomcat下直接打开即可

    springside-core-4.1.0.GA.jar

    8. **持续集成**:与Hudson或Jenkins等持续集成工具的集成,使得项目的构建和部署自动化,提高了开发团队的工作效率。 9. **文档生成**:使用Javadoc和Doxygen等工具自动生成API文档,方便开发者理解和使用。 10. ...

    Jenkins教程-代码质量测试工具:SonarQube.docx

    SonarQube 是一个用于代码质量管理的开放平台,通过插件机制,SonarQube 可以集成不同的测试工具,代码分析工具,以及持续集成工具,例如 Hudson/Jenkins 等。SonarQube 官方网站为 http://www.sonarqube.org/,...

    hudson配置注意.docx

    - 日志文件:`/var/log/hudson/hudson.log` - HUDSON_HOME:`/var/lib/Hudson` - War 文件:`/usr/lib/hudson/hudson.war` 需要修改`/etc/sysconfig/hudson`文件,设置`HUDSON_USER`为你希望用来运行Hudson的...

    hudson-3.1.0.war

    •易于安装-只要把hudson.war部署到servlet容器,不需要数据库支持。 •易于配置-所有配置都是通过其提供的web界面实现。 •集成RSS/E-mail/IM-通过RSS发布构建结果或当构建失败时通过e-mail实时通知。 •生成...

    hudson配置说明

    1. JDK 1.5 Update 7:Hudson 需要Java环境来运行,因此必须先安装JDK,并在系统环境变量中设置 `JAVA_HOME` 指向JDK的安装目录。 2. Ant:Hudson 使用Ant进行构建操作,同样需要在环境变量中设置 `ANT_HOME` 并添加...

    hudson1.293.war

    Hudson是 Jenkins 的前身,是一个开源的、基于Java开发的持续集成服务器,用于自动化各种软件工程任务,如构建、测试和部署。 【描述】"hudson1.293.war" 文件的描述简洁,表明这是一个Hudson的特定版本——1.293版...

    hudson1.293.part1.rar

    当Hudson.war被部署到支持Servlet容器(如Tomcat)时,它会自动启动一个Hudson服务器。用户可以通过浏览器访问Hudson的Web界面,进行项目配置、构建调度以及结果查看等一系列操作。 在“hudson1.293.part1.rar”这...

    持续集成篇-Hudson持续集成服务器的安装配置和使用.docx

    然后,需要将 war 包拷贝到 hudson-tomcat/weapps 目录,并重命名为 hudson.war。 七、防火墙设置 需要防火墙开启 8080 端口,具体步骤如下: 1. 编辑防火墙配置文件:vi /etc/sysconfig/iptables 2. 增加防火墙...

    Linux安装Cacti、Hudson、Jmeter、SVN

    1. 添加Hudson的YUM仓库:`vi /etc/yum.repos.d/hudson.repo`,添加仓库信息。 2. 安装Hudson:`yum install hudson` 3. 启动Hudson:`service hudson start` 4. 访问`http://your_server_ip:8080`进行Web配置。 **...

    hudson.freemarker_ide_0.9.14

    hudson.freemarker_ide_0.9.14 hudson.freemarker_ide_0.9.14 hudson.freemarker_ide_0.9.14 hudson.freemarker_ide_0.9.14 hudson.freemarker_ide_0.9.14

    hudson教程

    2. **JDK 1.7.0 或更高版本**:Hudson需要Java运行时环境。配置`JAVA_HOME`和`CLASSPATH`系统变量,并将 `%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin` 添加到系统的`Path`变量中。通过在命令行输入 `java -version` 来...

Global site tag (gtag.js) - Google Analytics