You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Peter Connolly (JIRA)" <ji...@apache.org> on 2008/09/12 20:28:46 UTC

[jira] Created: (CXF-1798) DynamicClientFactory does not work when called through Ant

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


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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644187#action_12644187 ] 

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

Hmm. Got any suggestions?

> 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Jon Sharp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644186#action_12644186 ] 

Jon Sharp commented on CXF-1798:
--------------------------------

I've also run into this issue.  I just wanted to add that I too would find it useful to have this issue resolved.

> 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Peter Connolly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644376#action_12644376 ] 

Peter Connolly commented on CXF-1798:
-------------------------------------

The root issue is that DynamicClientFactory is dependent on consumers using a URLClassLoader.  As you mentioned, the original notes for this JIRA describe two bugs that stem from this root issue: 1. An empty classpath results in an invalid system call to javac and 2. Using any classloader that doesn't extend URLClassLoader will result in an empty classpath.  I'm not asking that Sun does a better job at arranging their classloaders, I'm suggesting that DynamicClientFactory could make use of the way Sun prescribes doing parent classloader delegation.  One way to accomplish all of these goals, as well as improve the security and maintainability of DynamicClientFactory, could be to use the Compiler or ToolProvider classes.

> 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.


[jira] Updated: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Peter Connolly (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Connolly updated CXF-1798:
--------------------------------

    Attachment: build.xml

> 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.


[jira] Updated: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Peter Connolly (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Connolly updated CXF-1798:
--------------------------------

    Priority: Minor  (was: Major)

> 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
>
> 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Jon Sharp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644302#action_12644302 ] 

Jon Sharp commented on CXF-1798:
--------------------------------

Well, I can add that this behavior doesn't seem to be limited to Ant.

As for what to do with the code, I'm afraid I'm not very familiar with the DynamicClient code, but I can dig into it a little.  Have we tried Peter's suggestions yet?  He seems to have an educated idea regarding the issue.

> 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644477#action_12644477 ] 

Daniel Kulp commented on CXF-1798:
----------------------------------


And using the Compiler thing doesn't work on Java 5 unless the user puts the tools jar on the classpath.  That is why it was done the current way.

Plus the Compiler class in some of the VM's leaks memory really badly.  The newer version might be better though.

> 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Peter Connolly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644510#action_12644510 ] 

Peter Connolly commented on CXF-1798:
-------------------------------------

I just dowloaded cxf v 2.1.3 and I can't reproduce this issue.  Instead of the AntClassLoader being passed to the DynamicClient, the classloader for the java call (GroovyClassLoader) is being passed instead.  

> 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.


[jira] Updated: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Peter Connolly (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Connolly updated CXF-1798:
--------------------------------

    Attachment: output.log

> 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644369#action_12644369 ] 

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

I thought that this described two issues: one for which there was a specific suggestion, and one that seems to be wishing that Sun did a better job of arranging the modularity of (potential) class loaders.

> 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.


[jira] Updated: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Peter Connolly (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Connolly updated CXF-1798:
--------------------------------

    Attachment: GroovyWSTest.java

> 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.


[jira] Commented: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Peter Connolly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644307#action_12644307 ] 

Peter Connolly commented on CXF-1798:
-------------------------------------

Ideally, DynamicClientFactory should not have to do any string construction of a classpath.  When working with classloaders, typically a delegation model is used where a classloader defers to its parent to look for a class or resource.  Depending on what jdks cxf must compile in, it might be worth looking into using java.lang.Compiler or javax.tools.ToolProvider (jdk 6).  Using these would eliminate the need for a system call to javac and I'm hoping there is a way to delegate loading of classes to the classloader passed to createClient.

It might be worth noting that using a system call for javac requires consumers of DynamicClientFactory to allow all system calls by cxf code (if java security is turned on).  On the other hand, the Compiler class is already privileged.  I would see the ability to lock down the security on cxf as an added benefit of using Compiler or ToolProvider.

> 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.


[jira] Resolved: (CXF-1798) DynamicClientFactory does not work when called through Ant

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies resolved CXF-1798.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.4

If it works, it works.

> 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
>             Fix For: 2.1.4
>
>         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.