使用Ant将EAR部署到远程Websphere应用程序服务器 [英] Using Ant to deploy EAR to remote websphere application server

查看:495
本文介绍了使用Ant将EAR部署到远程Websphere应用程序服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自动将我们的持续集成服务器中的EAR文件构建部署到websphere应用程序服务器。我查找了Ant任务 wsdeploy ,但是文档根本没有帮助。我将其添加到我的蚂蚁脚本中:



WSDeploy Ant任务

 <类路径> 
< fileset dir =$ {dir.was.plugins}>
< include name =** / *。jar/>
< / fileset>
< / classpath>
< taskdef name =wsdeployclassname =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



我重写了我的蚂蚁脚本,现在没有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 derSOAP-Verbindung zuMYHOST。 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主机MYHOST一个端口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 nichtverfügbar。
[wsadmin] WASX7015E:Beim Ausf?hren des Befehls$ AdminApp列表ist eine Ausnahme eingetreten。 Informationen zur Ausnahme:
[wsadmin] com.ibm.ws.scripting.ScriptingException:WASX7206W:Der Application Management Service ist nicht aktiv。死亡者死亡Anwendungsverwaltung k?nnen nicht ausgef?hrt werden。
[wsadmin] Java结果:103

更新1 / p>

使用wsinstallapp



阅读 JoseKs answer 我试图使用 wsinstallapp 使用此Ant目标安装我的应用程序:

 < taskdef name =wsInstallAppclassname = com.ibm.websphere.ant.tasks.InstallApplicationclasspath =$ {dir.was.plugins} /com.ibm.ws.runtime_6.1.0.jar/> 

< target name =deploydepends =EAR>
< wsInstallApp
wasHome =$ {WAS_HOME}
ear =MYAPPLICATION.ear
options =
properties =

port =$ {TargetPort}
user =$ {TargetUser}
password =$ {TargetPwd}
failonerror =true/>
< / target>

但这是我所得到的:

  deploy:
[wsInstallApp] Anwendung wird installiert [/path/to/MYAPPLICATION.ear] ...
[wsadmin]线程mainjava中的异常。 lang.NoClassDefFoundError:org.eclipse.core.launcher.Main
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:335)
[wsadmin]在com.ibm .wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:91)
[wsadmin]导致:java.lang.ClassNotFoundException:org.eclipse.core.launcher.Main
[wsadmin]在java。 net.URLClassLoader.findClass(URLClassLoader.java:496)
[wsadmin]在java.lang.ClassLoader.loadClass(ClassLoader.java:631)
[wsadmin]在sun.misc.Launcher $ AppClassLoader。 loadClass(Launcher.java:349)
[wsadmin]在java.lang.ClassLoader.loadClass(ClassLoader.java:597)
[wsadmin] ...另外

我不知道为什么这个任务正在搜索Eclipse类...

解决方案

我相信将EAR实际部署到远程Websphere上的蚂蚁任务是 wsInstallApp 如下所述这里

 < taskdef name =wsInstallAppclassname =com.ibm.websphere.ant.tasks.InstallApplication/> 




< wsInstallApp
wasHome =websphere安装的位置
ear =您要安装的ear文件
options =传递给安装过程的选项
properties =java属性文件包含在JVM系统属性中设置的属性
profile =要在之前执行的脚本文件主命令或文件
conntype =指定要使用的连接类型。
host =主机连接到
port =主机端口连接到
user =用户ID进行身份验证
password =密码使用
failonerror =true | false/>进行身份验证


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 task

<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>

My Problem

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.

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?


UPDATE 2

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...

Call to Ant:

%WAS_HOME%\bin\ws_ant.bat -Duser.install.root="%WAS_HOME%\profiles\EXPECTEDPROFILE" -f buildall.xml "%1"

I want to run all this with EXPECTEDPROFILE, but the error message that is following suggests that there is another profile UNEXPECTEDPROFILE involved.

Output:

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

UPDATE 1

Using wsinstallapp

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

I don't know why the task is searching for an Eclipse class...

解决方案

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应用程序服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆