0

我正在尝试执行 webSphere wsadmin 脚本的 wsStopApp ant 脚本。代码如下:

<target name="WAS_wsStopApp">
            <property name="dep_var" value="was_home" />
            <antcall target="depCheck" />
            <property name="dep_var" value="was_appname" />
            <antcall target="depCheck" />
            <taskdef name="wsStopApp" classname="com.ibm.websphere.ant.tasks.StopApplication" classpath="${was_cp}" />
            <echo message="Value of was_home is ${was_home} and classpath is ${was_cp}"/>
            <wsStopApp application="${was_appname}" user="${was_user}" password="${was_password}" failonerror="${was_failonerror}" washome="${was_home}" profileName="AppSrv03"/>
    </target>

所有属性都在属性文件中正确设置。由was_cpant 脚本设置如下

        <path id="was.runtime">
            <fileset dir="${was_home}/lib">
                    <include name="**/*.jar" />
            </fileset>
            <fileset dir="${was_home}/plugins">
                    <include name="**/*.jar" />
            </fileset>
            <fileset dir="${was_home}/java/jre/lib">
                    <include name="**/*.jar"/>
            </fileset>
    </path>
    <property name="was_cp" value="${toString:was.runtime}" />

我可以看到它在类路径中包含所有给定的 jar。但是,在执行 wsStopApp 目标脚本后,我收到以下错误:

[wsStopApp] profileHome=/opt/middleware/cloudapp/WebSphere/85-64/profiles/AppSrv03
[wsadmin] The IBM Class Sharing Adaptor will not work in this configuration.
[wsadmin] You are not running on a J9 Java VM.
[wsadmin] org.eclipse.core.runtime.CoreException: Plug-in "com.ibm.ws.admin.services" was unable to instantiate class com.ibm.ws.scripting.WasxShell".
[wsadmin]   at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
[wsadmin]   at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:188)
[wsadmin]   at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:904)
[wsadmin]   at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
[wsadmin]   at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
------
------
[wsadmin] Caused by: java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/ORB
[wsadmin]     at java.lang.Class.forName0(Native Method)
[wsadmin]     at java.lang.Class.forName(Class.java:190)
[wsadmin]     at com.ibm.ws.util.PlatformHelperFactory.getBackupHelper(PlatformHelperFactory.jav:123)
[wsadmin]     at com.ibm.ws.util.PlatformHelperFactory.getPlatformHelper(PlatformHelperFactory.java:89)
[wsadmin]     at com.ibm.ws.management.AdminHelper.getPlatformHelper(AdminHelper.java:139
[wsadmin]     at com.ibm.ws.scripting.AbstractShell.<init>(AbstractShell.java:240)
[wsadmin]     at com.ibm.ws.scripting.WasxShell.<init>(WasxShell.java:200)

有人可以提供解决方案吗?我使用的 Websphere 版本是 8.5。

4

1 回答 1

0

您需要使用ws_ant.bat/sh随您的 WebSphere 配置文件提供的脚本运行脚本。这对我有用:

<?xml version="1.0" encoding="UTF-8"?>
<project name="proj" default="main">
        <taskdef name="wsStopApp" classname="com.ibm.websphere.ant.tasks.StopApplication"/>
        <target name="main">
            <wsStopApp application="TestAppEAR" user="wasadmin" password="password"/>
        </target>
</project>

然后调用它:

C:\IBM\WebSphere\AppServer85\profiles\AppSrv01\bin>ws_ant.bat -f stopAnt.xml

Buildfile: D:\workspacePWroc\AntTest\stopAnt.xml

main:
[wsStopApp] Stopping Application [TestAppEAR]...
  [wsadmin] WASX7209I: Connected to process "server1" on node node01 using
 SOAP connector;  The type of process is: UnManagedProcess
[wsStopApp] Stopped Application [TestAppEAR]

BUILD SUCCESSFUL
Total time: 8 seconds
于 2015-03-17T09:50:01.737 回答