deployment - 使用 Ant 将 EAR 部署到远程 websphere 应用服务器

标签 deployment ant websphere

我想将我们的持续集成服务器中的 EAR 文件构建自动部署到 websphere 应用程序服务器 .我查了 Ant 任务 wsdeploy ,但 documentation真的一点帮助都没有。我将此添加到我的 ant 脚本中:

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 服务器的工作 Ant 片段。

我们已经为 portlet 运行了一些 SCP 和 SSHEXEC 任务,它们正在调用 XMLAccess 接口(interface)来放置和启动 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 answer我尝试使用 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如记录 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"/>

关于deployment - 使用 Ant 将 EAR 部署到远程 websphere 应用服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3117785/

相关文章:

Android Studio 未将更改部署到应用程序

node.js - heroku sh : 1: tsc: not found

java - Ant 到 Gradle 迁移- exec 任务

java - 如何在 ant 文件调用批处理文件时构建失败,该批处理文件调用 ant 文件

java - WAS 8.5 : java. lang.ClassCastException : org. apache.xerces.jaxp.SAXParserFactoryImpl 与 javax.xml.parsers.SAXParserFactory 不兼容

java - WSJDBCConnection 不包装 Oracle jdbc Connection 类型的对象

iphone - Xcode 4中的 "Deployment target"和 "iOS deployment target"有什么区别

python - 如何在 Microsoft Azure 云服务上部署 django Web 应用程序

ant - 如何在Ant中使用类似数组或列表的内容?

logging - WebSphere (8.5.5) 不记录 OpenJPA