AXIS2 开发笔记
1.下载axis2.war放到tomcat webapp下解压,删除war,以后的aar(或者直接用ant打jar更方便)放到\webapps\axis2\WEB-INF\services下
2.配置axis2日志在\webapps\axis2\WEB-INF\classes下
log4j.rootLogger=DEBUG, console, logFile #DEBUG INFO WARN ERROR FATAL #Console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d{yyyyMMdd|HH:mm:ss} [%p] [%t] %m%n #logFile log4j.appender.logFile = org.apache.log4j.DailyRollingFileAppender log4j.appender.logFile.threshold = debug log4j.appender.logFile.File = c:/log/switchSer.log log4j.appender.logFile.Append = true log4j.appender.logFile.layout = org.apache.log4j.PatternLayout log4j.appender.logFile.layout.ConversionPattern = %d{yyyyMMdd|HH:mm:ss} [%p] %t %c - %m%n #other log4j.logger.com.mchange.v2 = WARN log4j.logger.org.quartz = WARN log4j.logger.org.apache.axis2 = WARN log4j.logger.org.apache.axiom = WARN
3.用axis2插件Axis2 Service Archiver,Class File Location选择java工程的bin,一路默认,倒数第二步输入服务名(wsdl名)和要发布的类全路径,将会生成一个aar文件
4.将java工程的lib包复制到\webapps\axis2\WEB-INF\lib下
5.此时将arr部署到\webapps\axis2\WEB-INF\services下,或者打开http://localhost:8080/axis2/在线部署(不重启,用户名密码admin/axis2)
下面将进行ant自动部署,此时将打成jar放到远程services下
6.将arr包里面的META-INF下的2个文件复制到java工程里,方便每次打jar打到
7.执行build.xml
<?xml version="1.0" encoding="UTF-8"?> <project name="miugosrv" default="default"> <property name="dist" value="C:/jar/axis2"/> <property name="hostname" value="192.168.7.10"/> <property name="username" value="gzmgtest2"/> <property name="password" value="gzmgtest2"/> <property name="port" value="22352"/> <property name="dir" value="/home/gzmgtest2/apache-tomcat-7.0.22/webapps/axis2/WEB-INF/services"/> <property name="tomcatdir" value="/home/gzmgtest2/apache-tomcat-7.0.22/bin"/> <property name="sleep.time" value="5"/> <target name="default" depends="init"> <copydir dest="./temp" src="./bin"> <include name="**/*.class"/> <include name="**/*.xml"/> <include name="**/*.properties"/> </copydir> <jar destfile="${dist}/switchSer.jar" basedir="./temp" encoding="utf-8"/> <delete dir="./temp"/> <sshexec host="${hostname}" username="${username}" password="${password}" command="cd ${tomcatdir};./shutdown.sh;" trust="true" port="${port}"/> <sleep seconds="2" /> <scp file="${dist}/switchSer.jar" todir="${username}:${password}@${hostname}:${dir}" trust="true" port="${port}"/> <sleep seconds="2" /> <sshexec host="${hostname}" username="${username}" password="${password}" command="cd ${tomcatdir};./startup.sh;" trust="true" port="${port}"/> <sshexec host="${hostname}" username="${username}" password="${password}" command="ps -ef|grep java" trust="true" port="${port}"/> </target> <target name="init"> <mkdir dir="./temp"/> </target> </project>