Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法从命令行启动Liberty配置文件:无法创建任务或类型antlib:com.ibm.websphere.wlp.ant:server_Ant_Websphere 8_Websphere Liberty - Fatal编程技术网

无法从命令行启动Liberty配置文件:无法创建任务或类型antlib:com.ibm.websphere.wlp.ant:server

无法从命令行启动Liberty配置文件:无法创建任务或类型antlib:com.ibm.websphere.wlp.ant:server,ant,websphere-8,websphere-liberty,Ant,Websphere 8,Websphere Liberty,我正在尝试启动WebSphere Liberty profile server(名为WL_UAT_server) 但系统出现以下错误: /opt/myProject/build.xml:144: Problem: failed to create task or type antlib:com.ibm.websphere.wlp.ant:server Cause: The name is undefined. Action: Check the spelling. Action: Check t

我正在尝试启动WebSphere Liberty profile server(名为WL_UAT_server)

但系统出现以下错误:

/opt/myProject/build.xml:144: Problem: failed to create task or type antlib:com.ibm.websphere.wlp.ant:server
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of:
        -/usr/share/ant/lib
        -/home/root/.ant/lib
        -a directory added on the command line with the -lib argument


Total time: 2 seconds

非常感谢您的帮助。

您似乎错过了将
wlp anttasks.jar
复制到
$ANT_HOME/lib
目录的步骤。或者,如果您不想更改ant安装,可以使用 用于加载Liberty任务的
typedef
任务,例如:

<typedef resource="net/wasdev/wlp/ant/antlib.xml" 
       uri="antlib:net.wasdev.wlp.ant" 
       classpath="somewhere/wlp-anttasks.jar"/>

我已经在ant 1.7.1上测试了以下构建文件,它运行良好。 如果我从
ant\lib
文件夹中删除
wlp anttasks.jar
,我就会收到您的错误。 因此,请仔细检查文件是否存在并且具有可读性-正确的权限?也许您正在从不同的用户运行构建?或者你没有访问Liberty或服务器文件夹的权限

检查同一用户是否可以使用以下命令行启动服务器:

C:\IBM\WebSphere\wlp\bin>server start WLP_UAT_Server
Starting server WLP_UAT_Server.
Server WLP_UAT_Server started.
这是我的
build.xml
文件

<project name="libertyTest" default="start-server" xmlns:wlp="antlib:com.ibm.websphere.wlp.ant">
    <description>
            description
    </description>
    <!-- set global properties for this build -->
      <property name="wlp_install_dir" value="C:/IBM/WebSphere/wlp"/>
      <property name="serverName" value="WLP_UAT_Server"/>

    <target name="start-server" description="description">
        <wlp:server id="wlp.ant.test" installDir="${wlp_install_dir}" operation="start" serverName="${serverName}" />
        <wlp:server ref="wlp.ant.test" operation="status"/>
    </target>

    <target name="stop-server" description="description">
            <wlp:server id="wlp.ant.test" installDir="${wlp_install_dir}" operation="stop" serverName="${serverName}" />
    </target>
</project>

我怀疑类似的情况,但是如果你看一下他的
ANT_HOME/lib
列表,jar已经存在了。除非他以某种方式调用了不同的ant。@Holly Cummins…我已经将wlp-anttasks.jar复制到$ant_HOME/lib文件夹中。您可以在问题描述中的“ANT_HOME/lib jar listing”下看到。您是作为独立工具运行ANT,还是从Eclipse或其他开发工具运行ANT?@Gas我是从命令行运行它的。不过幸运的是:-)。我想,也许你把它叫做Eclipse,因为它使用的是不同的类路径和ANT_HOME。你知道我做错了什么吗?我仍然无法从命令行启动它。它给了我和我在问题中提到的相同的错误,并且它在eclipse中工作得很好。@preraktivari也许你的Ant安装不正确。查看您的ANT属性,它们很奇怪-您的
ANT.core.lib
与您的
ANT.home
来自不同的文件夹。我已使用以下命令在我的计算机上安装了和:“yum install ANT”。我要卸载它并尝试其他东西吗?@PrerakTiwari是的,卸载它,然后从卸载ant下载并解压缩安装,然后再次安装它就可以了。它工作得很好。非常感谢。
<typedef resource="net/wasdev/wlp/ant/antlib.xml" 
       uri="antlib:net.wasdev.wlp.ant" 
       classpath="somewhere/wlp-anttasks.jar"/>
C:\IBM\WebSphere\wlp\bin>server start WLP_UAT_Server
Starting server WLP_UAT_Server.
Server WLP_UAT_Server started.
<project name="libertyTest" default="start-server" xmlns:wlp="antlib:com.ibm.websphere.wlp.ant">
    <description>
            description
    </description>
    <!-- set global properties for this build -->
      <property name="wlp_install_dir" value="C:/IBM/WebSphere/wlp"/>
      <property name="serverName" value="WLP_UAT_Server"/>

    <target name="start-server" description="description">
        <wlp:server id="wlp.ant.test" installDir="${wlp_install_dir}" operation="start" serverName="${serverName}" />
        <wlp:server ref="wlp.ant.test" operation="status"/>
    </target>

    <target name="stop-server" description="description">
            <wlp:server id="wlp.ant.test" installDir="${wlp_install_dir}" operation="stop" serverName="${serverName}" />
    </target>
</project>
-------------------------------------------
 ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant version 1.7.1 compiled on June 27 2008
ant.java.version: 1.6
ant.core.lib: C:\install\apache-ant-1.7.1\lib\ant.jar
ant.home: C:\install\apache-ant-1.7.1\bin\..