Search code examples
javaantweblogicclasspath

Ant Build - taskdef cannot be found


I am attempting to perform an Ant build to build a web service from a WSDL file for a Weblogic web application. However, I am receiving the following error upon attempting the build:

BUILD FAILED 
/<path>/build.xml:19: taskdef class weblogic.wsee.tools.anttasks.WsdlcTask cannot be found 
using the classloader AntClassLoader[]

The taskdefs in the build/xml look like this:

<taskdef name="wsdlc"
         classname="weblogic.wsee.tools.anttasks.WsdlcTask"/>
<taskdef name="jwsc"
  classname="weblogic.wsee.tools.anttasks.JwscTask" />
<taskdef name="clientgen"
  classname="weblogic.wsee.tools.anttasks.ClientGenTask" />
<taskdef name="wldeploy"
  classname="weblogic.ant.taskdefs.management.WLDeploy"/>

I have also tried to explicitly define the classpath in these taskdefs as follows, with no success:

<taskdef name="wsdlc"
           classname="weblogic.wsee.tools.anttasks.WsdlcTask"
           classpath="/WebContent/WEB-INF/lib/weblogic.jar"/>

And this is the classpath of the build.xml file:

classpath of build.xml

I have no clue why I get a "class cannot be found" error... I'm following instructions from Oracle docs - Building a Web Application from an WSDL file for the format of the build.xml file.

Notes: I am NOT executing this build.xml file from the same location the Weblogic server is being run from, as the Weblogic server does not have Ant installed. I am attempting to build it locally, in order to get the web service created, to finally deploy it in an EAR bundle of the WAR file + web service through the Weblogic console.


Solution

  • you need to set WLS domain environment (setDomainEnv.sh)., otherwise ant cannot find proprietary WLS classes.

    (setDomainEnv.cmd for Windows and setDomainEnv.sh for Linux).

    to achieve that you need to:

    source ./setDomainEnv.sh