官方下载
http://www.jboss.org/jbossas/downloads/
Linux下安装jboss4.2
官方网站
www.jboss.org
下载地址:
http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942&release_id=507793
下载文件
jboss-4.2.0.GA.zip
解开压缩
unzip jboss-4.2.0.GA.zip
移动到安装文件夹
mv jboss-4.2.0.GA /usr/local
修改配置
vi /etc/profile
JBOSS_HOME=/usr/local/jboss-4.2.0.GA
export JBOSS_HOME
准备好war包,调用ANT命令完成build.xml如下:
<project name="MyProject" default="compile" basedir=".">
<!-- set global properties for this build -->
<property name="project" value="ehome"/>
<property name="src" location="src/java"/>
<property name="config" location="src/conf"/>
<property name="web" location="WebRoot"/>
<property name="web-lib" location="${web}/WEB-INF/lib"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<path id="classpath.compile">
<fileset dir="${web-lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${build}"/>
</path>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
</target>
<target name="compile" depends="init" description="compile the source" >
<mkdir dir="${build}/classes"/>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}/classes" debug="true" deprecation="true" optimize="false" failοnerrοr="true" encoding="utf-8">
<classpath refid="classpath.compile"/>
</javac>
</target>
<target name="copyWebFiles" depends="compile">
<mkdir dir="${build}/web"/>
<copy todir="${build}/web">
<fileset dir="${web}" excludes="WEB-INF/classes/">
</fileset>
</copy>
<copy todir="${build}/web/WEB-INF/classes">
<fileset dir="${build}/classes">
</fileset>
<fileset dir="${config}">
<exclude name="**/*.properties"/>
<exclude name="**/*.prod"/>
</fileset>
</copy>
</target>
<target name="config4debug">
<copy file="${config}/ehome.properties" tofile="${dist}/ehome.properties"/>
</target>
<target name="config4release">
<copy file="${config}/ehome.properties.prod" tofile="${dist}/ehome.properties"/>
</target>
<target name="buildWar">
<mkdir dir="${dist}"/>
<war destfile="${dist}/${project}.war" webxml="${build}/web/WEB-INF/web.xml">
<fileset dir="${build}/web"/>
</war>
</target>
<target name="jarWebServices">
<jar destfile="${dist}/webservices-interface.jar" basedir="${build}/classes" includes="com/megaeyes/core/webservice/**" excludes="com/megaeyes/core/webservice/impl/**,com/megaeyes/core/webservice/transformer/**"/>
</target>
<target name="war" depends="clean,copyWebFiles,config4debug,buildWar" description="generate the war package for personal debug" >
</target>
<target name="release" depends="clean,copyWebFiles,config4release,buildWar" description="generate the war package for release" >
</target>
<target name="clean" description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
ant war 得到ehome.war
ant config4bug 得到ehome.properties
将ehome.war放置到/usr/local/jboss-4.2.0.GA/server/default/deploy/
将ehome.properties放置到/usr/local/jboss-4.2.0.GA/server/default/conf/
然后到bin下执行./run.sh就可以了,放后台运行./run.sh &
部署后启动JBOSS发现报这个错误:
07:45:20,624 WARN [JARDeployer] Failed to add deployable jar: file:/usr/local/jboss-4.2.0.GA/server/default/tmp/deploy/tmp486662
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
(MainDeployer.java:782)
找来找去。原来是我得JBOSS用SFTP得方式传上LINUX机器得,可能有问题。
我改用FTP得BIN模式传上去了就不报这个错误了。