使用Ant部署EAR到远程WebSphere Application Server [英] Using Ant to deploy EAR to remote websphere application server
问题描述
我想在我们的持续集成服务器EAR文件构建一个WebSphere应用服务器自动部署。我抬头Ant任务 wsdeploy
,而<一个href=\"http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/ant/tasks/WSDeploy.html\">documentation真的是没有帮助的。我说这我的Ant脚本:
I want to automatically deploy a EAR file build in our continuous integration server to a websphere application server. I looked up the Ant task wsdeploy
, but the documentation really isn't helpful at all. I added this to my ant script:
WSDeploy Ant任务
<classpath>
<fileset dir="${dir.was.plugins}">
<include name="**/*.jar" />
</fileset>
</classpath>
<taskdef name="wsdeploy" classname="com.ibm.websphere.ant.tasks.WSDeploy" />
<target name="deploy">
<wsdeploy inputFile="myearfile.ear"
outputFile="myearfile_fordeployment.ear"
classpath="${classpath}"
debug="true"
ignoreErrors="false"
noValidate="false"
trace="true" />
</target>
我的问题
我不知道如何指定远程服务器地址,我会很高兴得到一些教程的链接或者一个工作蚂蚁片段来部署EAR到WebSphere服务器。
I don't know how to specify the remote server address and I'd be glad to get some links to tutorials or maybe a working Ant snippet to deploy an EAR to the websphere server.
我们已经有一些SCP和运行Portlet的SSHEXEC任务,他们正在调用的的XMLAccess 的接口,放置并启动的portlet。我必须去适应的脚本为EAR太升是一个完全错误的方式自动部署EAR文件?
We already have some SCP and SSHEXEC tasks running for the portlets, and they're calling the XMLAccess interface to place and start the portlets. Do I have to adapt that scripts for the EAR too or is that a completely wrong way to automatically deploy an EAR file?
更新2
我改写了我的Ant脚本,现在也没有了ClassNotFoundException了。不过,有一个意想不到的现象:脚本要用我从来没有指定配置文件...
I rewrote my ant script and now there is no ClassNotFoundException anymore. Still, there is an unexpected behavior: The script wants to use a profile I never specified...
呼叫到Ant:
%WAS_HOME%\bin\ws_ant.bat -Duser.install.root="%WAS_HOME%\profiles\EXPECTEDPROFILE" -f buildall.xml "%1"
我想与 EXPECTEDPROFILE
运行这一切,但是这是继错误信息表明,还有另外一个配置文件 UNEXPECTEDPROFILE
参与。
I want to run all this with EXPECTEDPROFILE
, but the error message that is following suggests that there is another profile UNEXPECTEDPROFILE
involved.
输出:
wasListApps:
[wsadmin] WASX7023E: Fehler beim Erstellen der "SOAP"-Verbindung zu "MYHOST". Informationen zur Ausnahme: com.ibm.websphere.management.exception.ConnectorNotAvailableException: com.ibm.websphere.management.exception.ConnectorNotAvailableException: ADMC0016E: Das System kann keinen SOAP-Connector erstellen, um die Verbindung zum Host MYHOST an Port MYPORT herzustellen.
[wsadmin] WASX7213I: Dieser Script-Client ist mit keinem Serverprozess verbunden. Pr?fen Sie, ob in der Protokolldatei /PATH/TO/UNEXPECTEDT/PROFILE/logs\wsadmin.traceout n?here Einzelheiten enthalten sind.
[wsadmin] WASX8011W: Das AdminTask-Objekt ist nicht verfügbar.
[wsadmin] WASX7015E: Beim Ausf?hren des Befehls "$AdminApp list" ist eine Ausnahme eingetreten. Informationen zur Ausnahme:
[wsadmin] com.ibm.ws.scripting.ScriptingException: WASX7206W: Der Application Management Service ist nicht aktiv. Die Befehle f?r die Anwendungsverwaltung k?nnen nicht ausgef?hrt werden.
[wsadmin] Java Result: 103
更新1
使用wsinstallapp </ STRONG>
Using wsinstallapp
看完<一个href=\"http://stackoverflow.com/questions/3117785/using-ant-to-deploy-ear-to-remote-websphere-application-server/3117920#3117920\">JoseKs回答我试图用 wsinstallapp </ code>与此Ant目标安装我的应用程序:
After reading JoseKs answer I tried to use wsinstallapp
to install my application with this Ant target:
<taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" classpath="${dir.was.plugins}/com.ibm.ws.runtime_6.1.0.jar" />
<target name="deploy" depends="EAR">
<wsInstallApp
wasHome="${WAS_HOME}"
ear="MYAPPLICATION.ear"
options=""
properties=""
profile=""
conntype="SOAP"
host="${TargetServer}"
port="${TargetPort}"
user="${TargetUser}"
password="${TargetPwd}"
failonerror="true" />
</target>
但是,这是我所得到的:
But this is what I get:
deploy:
[wsInstallApp] Anwendung wird installiert [/path/to/MYAPPLICATION.ear]...
[wsadmin] Exception in thread "main" java.lang.NoClassDefFoundError: org.eclipse.core.launcher.Main
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:335)
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:91)
[wsadmin] Caused by: java.lang.ClassNotFoundException: org.eclipse.core.launcher.Main
[wsadmin] at java.net.URLClassLoader.findClass(URLClassLoader.java:496)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:631)
[wsadmin] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
[wsadmin] ... 2 more
我不知道为什么任务是寻找一个Eclipse类...
I don't know why the task is searching for an Eclipse class...
推荐答案
我相信实际部署EAR到远程WebSphere Ant任务是 wsInstallApp
作为记录<一个href=\"http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.wsps.602.javadoc.doc/doc/com/ibm/websphere/ant/tasks/InstallApplication.html\">here
I believe the ant task for actually deploying the EAR onto the remote Websphere is wsInstallApp
as documented here
<taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication"/>
<wsInstallApp
wasHome="location of websphere installation"
ear="the ear file you wish to install"
options="the options to pass to the installation process"
properties="java properties file containing attributes to set in the JVM System properties"
profile="a script file to be executed before the main command or file"
conntype="specifies the type of connection to be used."
host="the host to connect to"
port="the port on the host to connect to"
user="user ID to authenticate with"
password="password to authenticate with"
failonerror="true | false"/>
这篇关于使用Ant部署EAR到远程WebSphere Application Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!