0

After referring this article and this article, I am trying to run the ant script from a java class as follows:

    File buildFile = new File("D:\\Utility\\artifacts\\build.xml");
    Project p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    try
    {
        p.fireBuildStarted();
        p.init();
        ProjectHelper helper = ProjectHelper.getProjectHelper();
        p.addReference("ant.projectHelper", helper);
        helper.parse(p, buildFile);
        p.executeTarget(p.getDefaultTarget());
        p.fireBuildFinished(null);
    }
    catch (BuildException e)
    {
        p.fireBuildFinished(e);
    }

Following is the build.xml file:

<project name="buildWebservice" default="generate-from-wsdlc">

       <taskdef name="wsdlc" classname="weblogic.wsee.tools.anttasks.WsdlcTask"
            classpath="D:\bea\wlserver_10.3\server\lib\weblogic.jar" />

       <target name="generate-from-wsdlc">
            <wsdlc srcWsdl="D:\Utility\WSDLs\someWSDL.wsdl"
                type="JAXWS" destJwsDir="temp\JWS_InterfaceDir" destImplDir="temp\JWS_ImplDir">
            </wsdlc>
       </target>
</project>

But when i execute this java code, i get the following Exception in the console:

BUILD FAILED
D:\Utility\artifacts\build.xml:21: java.lang.NoSuchMethodError: com.sun.xml.ws.util.JAXWSUtils.getEncodedURL(Ljava/lang/String;)Ljava/net/URL;

I even decompiled the jaxws-rt.jar to look for getEncodedURL method in JAXWSUtils class but didn't find any such method.

Please help! Thanks in advance

Community
  • 1
  • 1
Azhar
  • 1
  • 1

1 Answers1

0

Try a different implementation regarding this forum entry: https://forums.oracle.com/forums/thread.jspa?threadID=1125462

Lexandro
  • 765
  • 5
  • 14
  • Thanks for the hint Lexandro! Could u please elaborate as to wat does a different impl mean? Actually i opened the thread and tried that but in vain. In fact the weblogic task(WSDLC) that i m calling, calls this method(getEncodeURL) internally. Note: The ant runs successfully from command line for the same task – Azhar Apr 19 '12 at 07:55
  • Compare the classpaths of these environments. Maybe they're pointing to different implementations (the default JDK impl vs. weblogic supplied one) – Lexandro Apr 19 '12 at 18:28