cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benson Margulies (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant
Date Fri, 31 Oct 2008 19:39:44 GMT

    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644412#action_12644412
] 

Benson Margulies commented on CXF-1798:
---------------------------------------

This all sounds reasonable. While I have been seen making changes to the DCF, I'm not an
expert on these technologies. I don't suppose you could be persuaded to spin up a patch? Or
failing that, a pointer to something exemplary?

> DynamicClientFactory does not work when called through Ant
> ----------------------------------------------------------
>
>                 Key: CXF-1798
>                 URL: https://issues.apache.org/jira/browse/CXF-1798
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0.5
>         Environment: I am using Groovy 1.5.6 with GroovyWS 0.3.1 on Windows XP. I am
calling Groovy via Ant 1.7.0.
>            Reporter: Peter Connolly
>            Priority: Minor
>         Attachments: build.xml, GroovyWSTest.java, output.log
>
>
> I've created GroovyWS code to talk to a web service.  GroovyWS uses ApacheCXF 2.0.5 to
dynamically create classes for the web services objects.  When this code is run via a batch
script, it runs correctly.  When this code is run via Ant, I get this error:
>      [java]  javac: invalid flag: C:/DOCUME~1/PCONNO~1/LOCALS~1/Temp/org.apache.
> cxf.endpoint.dynamic.DynamicClientFactory@1b67d6a-1219416496084-classes
> I think there are a couple of defects in the class DynamicClientFactory.  First, in the
compileJavaSrc method, the call to javac is constructed without checking if the classpath
is populated.  The code could be modified to conditionally append the classpath similar to
this:
> static boolean compileJavaSrc(Path classPath, Path srcPath, String dest) {
>         String[] srcList = srcPath.list();
>         List<String> javacCommand = new ArrayList<String>();
>         javacCommand.add("javac");
>         if(classPath != null && classPath.size() > 0){
>             javacCommand.add("-classpath");
>             javacCommand.add(classPath.toString());
>         }
>         javacCommand.add("-d");
>         javacCommand.add(dest.toString());
>         javacCommand.add("-target");
>         javacCommand.add("1.5");
>         for (int i = 0; i < srcList.length; i++) {
>             javacCommand.add(srcList[i]);
>         }
>         org.apache.cxf.tools.util.Compiler javaCompiler
>             = new org.apache.cxf.tools.util.Compiler();
>         return javaCompiler.internalCompile(javacCommand.toArray(new String[javacCommand.size()]),
javacCommand.size());
>     } 
> The next issue with DynamicClientFactory is the setupClasspath method.  This method explicitly
tests if the ClassLoader inherits from URLClassLoader and then appends the URLs from that
URLClassloader to its own classpath.  The AntClassLoader, unfortunately, does not extend from
the URLClassLoader.  When the classpath is constructed it is empty.  If the compileJavaSrc
method is fixed as above many calls will still fail because there is a dependency on classes
that are not present during compilation (i.e. GroovyWS classes).   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message