Using Weblogic JWSC Ant task with Maven

This post has been moved to here.

About these ads

34 Responses to Using Weblogic JWSC Ant task with Maven

  1. Vish says:


    Thanks for posting information on “Weblogic JWSC Ant task with Maven”. I was trying to implement exactly as described, but obviously I might be missing something; like classpath setting on my system.

    I’ve been getting following error when I ran project with the command “mvn clean install”.

    [INFO] ————————————————————————
    [INFO] An Ant BuildException has occured: The following error occurred while executing this line:
    C:\..\workspace\project\src\com\app\webservices-build.xml:103: java.lang.NoClassDefFoundError: com/sun/jav


    Any insight on resolving the issue will be appreciated.


  2. ricardoekm says:

    Hi Vish,
    This class is usually in located in tools.jar. There’s a line that tries to load it:

    classloader classpath="lib/tools.jar" loader="project

    So it’s necessary to copy tools.jar from your JDK (preferably 1.5) to a relative path lib/tools.jar.

    Please let me know if this helps.


    • Patrick says:

      Sorry, the xml I pasted got trashed…

      Add a dependency after the antrun executions section:


  3. Ark says:

    Hi Ricardo,

    Thanks for your post.

    I’m compiling with JDK 1.6.05 (supplied with WLS 10.3) but I continuing having a problem. Before adding a piece with ant-classloader I was plainly getting an odd NoClassDefNotFoundError for com/sun/javadoc/Type. After – something’s changed. Now I’m getting even a full explanatory why *thing* fails:

    Reason: Error executing ant tasks

    The following error occurred while executing this line:
    ..\build.xml:45: com.bea.util.jam.internal.javadoc.JavadocClassloadingException: An error has occurred while invoking javadoc to inspect your source
    files. This may be due to the fact that $JAVA_HOME/lib/tools.jar does
    not seem to be in your system classloader. One common case in which
    this happens is when using the ‘ant’ tool, which uses a special
    context classloader to load classes from tools.jar.

    This situation elicits what is believed to a javadoc bug in the initial
    release of JDK 1.6. Javadoc attempts to use its own context classloader
    tools.jar but ignores one that may have already been set, which leads
    to some classes being loaded into two different classloaders. The
    telltale sign of this problem is a javadoc error message saying that
    ‘languageVersion() must return LanguageVersion – you might see this
    message in your process’ output.

    This will hopefully be fixed in a later release of JDK 1.6; if a new
    version of 1.6 has become available, you might be able to solve this
    by simply upgrading to the latest JDK.

    Alternatively, you can work around it by simply including
    $JAVA_HOME/lib/tools.jar in the java -classpath
    parameter. If you are running ant, you will need to modify the standard
    ant script to include tools.jar in the -classpath.



    Maybe something more is still missing here?

    With best regards,

  4. Vishnu Koya says:


    Thanks for the reply Recardo.

    I was using jdk that came with wl10.3, ant version 1.7.1 and maven version 2.0.10.

    I’ve tried setting up the classpath using classloader, but for some reason ant is complaining about the “loader” attribute.

    classloader classpath="C:\bea\jdk160_05\lib\tools.jar;" loader="project"

    Error that I got with above line in Ant:

    [INFO] ------------------------------------------------------------------------
    [INFO] An Ant BuildException has occured: The following error occurred while executing this line:
    C:\..\build\build.xml:30: classloader doesn't support the "loader" attribute

    The type doesn't support the "loader" attribute.

    We fixed that issue by modifying the file “mvn.bat” located at “MAVEN_HOME\bin”.
    Search for “runm2″ in that file and add “tools.jar” location to the classpath under line “runm2″.

    It look like as follows on my machine.

    @REM Start MAVEN2
    %MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath C:\bea\jdk160_05\lib\tools.jar;%CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" org.codehaus.classworlds.Launcher %MAVEN_CMD_LINE_ARGS%
    if ERRORLEVEL 1 goto error
    goto end

    Though this solution doesn’t sound great, but it fixed the problem.

    Can anyone suggest how to fix “loader” attribute problem, so I don’t need to modify Maven files?

    Vishnu Koya

  5. ricardoekm says:

    Hi Ark,
    I think I solved this problem using tools.jar from JDK 1.5.
    As soon as possible I will update with the link where you can get the same file I’m using for my builds.

  6. ricardoekm says:

    Hi Vishnu,
    Could you please post your ant build xml?

  7. Vishnu Koya says:
    <project name="focalexposure.webservices.jaxws.java2wsdl" default="all" basedir=".">
      <!-- Web Service WLS Ant task definitions -->
      <taskdef name="jwsc"
    	            onerror="report" />
      <taskdef name="wldeploy"
      	  			onerror="report" />
      <target name="all" depends="build, deploy"/>
      <target name="build" depends="clean,init,"/> 
      <target name="clean">
        <delete dir="${}/${server.service.ear}" failonerror="false"/>
      <!-- Target that builds the target Web Service -->
      <target name="init">
        <mkdir dir="${server.service.dir}"/>
      <!-- Target that builds the target Web Service -->
      <target name="" description="Target that builds the target Web Service">
      	<!-- classloader classpath="C:\bea\jdk160_05\lib\tools.jar" loader="project" / -->
      		srcdir="${focalexposure.src.dir}" destdir="${server.service.dir}"
          <jws file="" type="JAXRPC" explode="true"/>	
          <jws file="" type="JAXRPC" wsdlOnly="true" explode="true"/>
    	<!-- Y - network drive is mapped to eComm1 -->
    	<copy todir="${server.service.dir}/FocalWebServiceImpl/WEB-INF/lib" overwrite="true">
            <fileset dir="Y:\backup\contractors\FocalExposure\lib" includes="**/*"/>
        <!-- copy *.jsp, *.js to war dir -->
        <copy todir="${server.service.dir}/FocalWebServiceImpl">
            <fileset dir="${focalexposure.ui.dir}/jsps" includes="**/*"/>
            <fileset dir="${focalexposure.ui.dir}/js" includes="**/*"/>
      <!-- Target that deploys the target Web Services -->
      <target name="deploy.server" description="Target that deploys the target Web Service">
      <!-- Target that deploys the all Web Services -->
      <target name="deploy" depends="deploy.server"
              description="Target that deploys the all Web Services">
      <!-- Target that undeploys the target Web Service -->
      <target name="undeploy.server" description="Target that undeploys the target Web Service">
        <antcall target="common_undeploy">
          <param name="name" value="${focalexposure.service.ear}"/>
      <!-- Target that undeploys all Web Service within these sample -->
      <target name="undeploy" depends="undeploy.server"
              description="Target that undeploys all Web Service within these sample">
      <target name="common_undeploy">

  8. shikha says:

    Hi ..I am not sure if you were able to solve the issue but I was running into the same issue using weblogic 10.3 with with maven to build ant task, and this is what I ended up doing

    So I am saying -noclasspath i.e. dont use the system classpath at all..
    I dont know if this is the clean way but atleast it works..I was trying to use the clasloader approach stated above..but it doesnot work for me

  9. shikha says:

    I am not sure how to post code here but what I did was =invoking ant using <java tag

  10. ricardoekm says:

    Lets try the reverse way. Here is a simple ant build that loads tools.jar using classloader task.
    Please let me know if it works for you.

    You may try to use the tools.jar attached to check if it solves your problem.

  11. Vishnu Koya says:

    Hi Ricardo,

    The simple ant build that you have provided works for just fine. If I use the ant-classloader.jar, tools.jar that you provided in my project, it works. If I replace the tools.jar that you gave with the one that come with Bea WebLogic10.3, my build fails.

    Can you please let me know where you got that tools.jar?

    Vishnu Koya

  12. ricardoekm says:

    Hi Vishnu,
    This tools.jar I got from JDK 1.5, downloaded from SUN website.

  13. Ark says:

    Hi Ricardo,

    I’m sorry for delay: tools.jar from jdk 1.5 does solve the problem of infinite classloader issues and the build finishes well. The tools.jar that comes with jdk 1.6 has a known bug in javadoc class loading, that can be solved only by adding tools.jar to a *system classpath*, adding it to ant classpath doesn’t help.

    Thank you again.

  14. ricardoekm says:

    Great Ark!

  15. Vishnu Koya says:

    Thank you all!

  16. John Fjellstad says:


    I tried to use your example, but keep getting a nullpointerexception. I was wondering if you can see what the problem might be:

    My pom entry:




  17. ricardoekm says:

    Hi John,
    Could you please send your pom entry to ricardo.ekm at gmail?

  18. Anandhu says:

    I have scenario similar to this.

    Maven version 2.2.1 (needs java 1.5)
    Ant Version 1.6.5 (needs java 1.4)

    Now I need to call my ant build script from maven.
    How should I do that?

  19. Ricardo Mayerhofer says:

    Hi, have you tried maven ant run task?
    What error shows up?

  20. Dennis H says:

    Thank you for article. It was very helpful. I too had issues with tools.jar with WebLogic 10.3. I wanted to use Maven’s dependency management instead of putting the jdk 1.5 tools.jar in the classpath. So this is the example that worked for me that I wanted to share with others:

  21. Dennis H says:

    Here is the code formatted correctly (I hope):

    					<path id="weblogic.jar.classpath">
    						<path location="${BEA103_HOME}/patch_wls1030/profiles/default/sys_manifest_classpath/weblogic_patch.jar"/>
    						<path location="${BEA103_HOME}/wlserver_10.3/server/lib/weblogic.jar"/>
    					<taskdef resource="net/jtools/classloadertask/antlib.xml" classpath="${maven.dependency.jtools.ant-classloadertask.jar.path}"/>
    					<taskdef name="jwsc" classname="" classpathref="weblogic.jar.classpath">
    							<path refid="weblogic.jar.classpath"/>
    					<property name="maven.compile.classpath" refid="maven.compile.classpath"/>
    					<jwsc destdir="target" classpathref="weblogic.jar.classpath" classpath="${maven.compile.classpath}" verbose="true" debug="true">
    						<module name="${project.artifactId}-${project.version}" explode="true" contextPath="pearsonaccess">
    							<jwsFileSet srcdir="src/main/java/">
    								<include name="**/*.java"/>
    		<!-- bea uses jdk tools 1.5  in jwsc causing this error when compiling with jdk tools 1.6: java.lang.NoClassDefFoundError: com/sun/javadoc/Type -->
  22. ricardoekm says:

    Great Dennis, thank you for this plus.

  23. ms shekar says:

    Need urgent help…
    I am running a jwsc ant task to generate a war file.
    It is working fine for me if I add the weblogic.jar to classpath before running the ant script ( CLASSPATH=/opt/bea/weblogic91/server/lib/weblogic.jar export CLASSPATH)

    But is is not working if i add this in my build.xml as follows

    I am getting the following error.

    [AntUtil.deleteDir] Deleting directory /var/tmp/_927vxb

    /wls_domains/CIT/cruisecontrol-bin-2.8.3/util/Ivy/build.xml:231: Deployment descriptor: /var/tmp/_927vxb/web.xml does not exist.
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    Caused by: Deployment descriptor: /var/tmp/_927vxb/web.xml does not exist.
    … 17 more
    — Nested Exception —
    Deployment descriptor: /var/tmp/_927vxb/web.xml does not exist.
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(

    Total time: 1 minute 3 seconds

    I am running weblogic91 in solaries system…….

  24. JmacWay says:

    Hi, I’d be very grateful for an extra pair of eyes to take a look at my problem. I tried many things but I keep getting the notorious error:
    webservices-build.xml:23: com.bea.util.jam.internal.javadoc.JavadocClassloadingException: An error has occurred while invoking javadoc to inspect your source files. This may be due to the fact that $JAVA_HOME/lib/tools.jar

    Here’s the webservices-build.xml:

    And the maven snippet:




  25. darshan says:

    @vishnu Koya
    hi vishnu
    @REM Start MAVEN2
    %MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath C:\bea\jdk160_05\lib\tools.jar;%CLASSWORLDS_JAR% “-Dclassworlds.conf=%M2_HOME%\bin\m2.conf” “-Dmaven.home=%M2_HOME%” org.codehaus.classworlds.Launcher %MAVEN_CMD_LINE_ARGS%
    if ERRORLEVEL 1 goto error
    goto end

    how do i achieve this part in linux platform in file
    exec “$JAVACMD” \
    -classpath “${M2_HOME}”/boot/plexus-classworlds-*.jar;”${JAVA_HOME}”/lib/tools.jar \
    “-Dclassworlds.conf=${M2_HOME}/bin/m2.conf” \
    “-Dmaven.home=${M2_HOME}” \
    It is giving me errors

  26. Sheri says:

    While the liquid microsoft windows within the position must prevent overfilling, I need to
    confess that one sleepy day we was not having to pay interest and also forgot that I got therefore loaded it alongside liquid the evening before.

    Drip Coffee Maker Commonly Asked queries Precisely what exactly is
    actually the really temperature for brewing coffee?
    all specialist consent which 200 levels is easily the most effective heat
    for brewing coffee.

  27. I must mention that I bought every one of the of the supplies during the dollar store, except my fish.
    whenever the kids boomers become senior citizens, they will have already understand about computers, having being taught through out college and even
    in highschool. And also, naturally, this sharpener is actually affordable and also
    it comes down by way of a great warranty. My husband and also I assist
    whenever needed and also regularly reveal exactly what my son is actually understanding at school.
    The proper store attracting should display every one of the the required
    information and facts that is required for the piece being built.

    expected to constants through their physical mobility, maybe likewise
    sight and also hearing, it presents the reachable challenge to one teacher or tutor in helping a senior learn.
    In fact, I recently wrote looking for bigger benefits through class materials and
    not being nervous to walk in return out the
    door when the store truly not provide up the awesome deals they promote.
    If possible, give consideration to finding term searches that coordinate
    a monthly holiday because most elementary schools touch on the major vacations.

  28. Take avantage d’avantage de tous seuls votre amène qui la mode, le style, ULTRAVIOLET la protection toutefois en plus le la part de légende comme de everything, alors . Ce particulier la collection fera le plaisir chaque un des passionnés D’accessoires pour le
    mois d’été best pour le day hors avec les amis ou à le promenade quant au la plage. qualité de carrera de lunettes à un coût, toutefois en fait moins que le cent euros j’en fait l’un exceptionnel offre vous offre this particulier le site de site Web, donc l’apprécier as partie de ceux-ci les temps de crise nous
    devoir nevertheless sent capable s’amuser. There j’en fait
    aussi le carbone variation j’en fait mon advice le la plupart d’ les versions de gorgeous du exact même .

    Éloigné d’ se reposant sur the passé le succès, récemment là je the vrai la motivation de tout les ces a impliqué dans initiating l’INNOVATION.

  29. le commerce, helped par le roi du roi Michael Jackson, aussi Motivé par
    Tom cruise comme de Idéal Arme, le film achievements. Il had a été mis sur le marché comme de 60
    ans mais à prise loin vingt les ans, 80 déterminer le start du sien awesome Le fera.
    si ne fait pas attente pour le second et gentillement un enjoyed l’un ou votre soi avec ceci le rabais incroyable passé ces lunettes de soleil de carrera bon marché. solaire qui regagne it je shape et aussi remplaçant le métal De high plastique de qualité aidé par le les Chats 5000.

  30. Bricklaying software include the mixer, wall ties, a
    bricklaying trowel, a spacing rule, and also the levels.
    In building construction the force and aesthetic beauty of brick walls, brick pillars depend in the quality of bonds.
    So from preparing the homework in order to final bricklaying Melbourne is actually ready below definitely one roof by
    a few of the reputable construction service providers.
    What Exactly Is desirable is actually a diploma after highschool
    and also this is certainly exclusively if you want to become apprentices.
    Create markings showing the location of each brick to choose as a guide while laying them.

  31. Sweet blog! I found it while surfing around on Yahoo News.

    Do you have any suggestions on how to get listed in Yahoo News?

    I’ve been trying for a while but I never seem to get there! Many thanks

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: