[英]How to deploy with Ant an portlet to remote WebSphere Portal?
[英]Using Ant to deploy EAR to remote websphere application server
我想在我们的持续集成服务器中自动将EAR文件构建部署到websphere应用程序服务器 。 我查找了Ant任务wsdeploy
,但文档确实没有任何帮助。 我把它添加到我的蚂蚁脚本中:
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>
我的问题
我不知道如何指定远程服务器地址,我很高兴获得一些指向教程的链接,或者可能是一个工作的Ant片段,用于将EAR部署到websphere服务器。
我们已经为portlet运行了一些SCP和SSHEXEC任务,他们正在调用XMLAccess接口来放置和启动portlet。 我是否必须为EAR调整脚本,或者这是一种完全错误的方式来自动部署EAR文件?
更新2
我重写了我的ant脚本,现在不再有ClassNotFoundException了。 仍有一个意外的行为:脚本想要使用我从未指定的配置文件...
致电Ant:
%WAS_HOME%\bin\ws_ant.bat -Duser.install.root="%WAS_HOME%\profiles\EXPECTEDPROFILE" -f buildall.xml "%1"
我想用EXPECTEDPROFILE
运行所有这些,但是下面的错误消息表明还有另一个配置文件UNEXPECTEDPROFILE
。
输出:
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
在阅读JoseKs的回答之后,我尝试使用wsinstallapp
来安装我的应用程序与此Ant目标:
<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>
但这就是我得到的:
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类......
我相信实际将EAR部署到远程Websphere上的ant任务是wsInstallApp
,如此处所述
<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"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.