Search code examples
javaantweblogicwlst

WLST ant task not finding classpathref


I am experimenting with wlst for a local weblogic deploy. I have created a build.xml, build.properties file and a simple wlst script. I have tested the script from the commandline and it works perfectly. However, I am having a hard time getting it to execute from my ant file.

build.xml

<project default="ListLibraries" name="WLST project">
<property file="build.properties" />

<taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask" classpathref="${weblogic.classpath.id}" />

  <target name="ListLibraries">
      <wlst fileName="${wlst.script.source}/ListLibraries.py" classpathref="${weblogic.classpath.id}" />
  </target>

</project>

build.properties

# Weblogic specific dirs
weblogic.home.dir=/Users/me/Oracle/Middleware/wlserver_10.3
weblogic.bin.dir=${weblogic.home.dir}/common/bin
weblogic.lib.dir=${weblogic.home.dir}/server/lib
weblogic.classpath.id=${weblogic.lib.dir}/weblogic.jar

#workspace dirs
wlst.script.source=/Users/me/workspaces/python/wls_config

This is what I see:

$ ant Buildfile: /Users/me/workspaces/java/myarrow/local/build.xml

BUILD FAILED /Users/me/workspaces/java/myarrow/local/build.xml:4: Reference /Users/me/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar not found.

Total time: 0 seconds

Blockquote

However, that weblogic.jar does exist:

$ ls -la /Users/me/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar
-rwxrwxrw-  1 a84055  my\Domain Users  36339849 Feb 13 15:45 /Users/me/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar

What am I missing here? It's probably right in front of my eyes.


Solution

  • classpathref expects a reference to a path, instead of the physical path. Try using classpath instead:

    <taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask" 
                         classpath="${weblogic.classpath.id}" />
    

    See https://ant.apache.org/manual/Tasks/typedef.html for examples using both attributes.

    With classpathref, you need to create a reference first:

    <path id="weblogic.lib.path">
      <fileset file="${weblogic.classpath.id}"/>
    </path>
    
    <taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask" 
                         classpathref="weblogic.lib.path" />