【问题标题】:Error while executing wsStopApp ant task unable to instantiate class com.ibm.ws.scripting.WasxShell执行 wsStopApp ant 任务时出错,无法实例化类 com.ibm.ws.scripting.WasxShell
【发布时间】:2015-03-17 05:47:09
【问题描述】:

我正在尝试执行 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_cp 由 ant 脚本设置如下

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

【问题讨论】:

    标签: ant classnotfoundexception websphere-8 wsadmin ibm-was


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-18
      • 1970-01-01
      • 2019-04-03
      • 2011-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多