2010-06-25 122 views
7

我想在我们的持续集成服务器EAR文件构建以在WebSphere Application Server自动部署。我抬头看看Ant任务wsdeploy,但documentation确实没有任何帮助。我说这个我ant脚本:使用Ant部署EAR到远程WebSphere Application Server

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任务,他们正在调用接口来放置和启动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类...

+0

你有没有得到这个工作? – blank 2011-08-05 12:17:14

+0

不,实际上我们正在使用Ant(它将EAR与SCP任务复制)以及运行在服务器机器上的jython脚本混合使用。 jython由wsadmin加载,我们在服务器上安装服务器本地EAR文件。 – cringe 2011-08-08 12:44:24

+0

您必须在SCP任务之后手动运行脚本,或者是使用WAS的计算机上的构建服务器?我发现我们无法从构建服务器进行自动化部署是很荒谬的。 – blank 2011-08-08 13:15:05

回答

6

我相信蚂蚁任务实际部署的EAR到远程Websphere是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"/> 
+0

感谢您指出此任务。不幸的是,文档是...我有另一个问题,但我会将它添加到我的Q,而不是在这里发布它作为评论。 – cringe 2010-06-28 08:12:03

+0

虽然这不解释日食classnotfound - 这是一个现实生活中的例子:http://www.jroller.com/holy/entry/was_6_0_ant_tasks。此网址和其他网址建议必须先通过“配置文件”。 http://www.theserverside.com/discussions/thread.tss?thread_id=32285 – JoseK 2010-06-28 10:01:56

相关问题