Mojo's Axis Tools Maven Plugin
  1. Mojo's Axis Tools Maven Plugin
  2. MAXISTOOLS-3

axistools:admin does not include target/classes in classpath

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: admin
    • Labels:
      None
    • Environment:
      windows xp sp2, maven 2.0.6, axistools 1.1
    • Number of attachments :
      1

      Description

      The execution of org.apache.axis.utils.Admin in the axistools:admin goal should contain the target/classes path (or whatever path, the classes are compiled to) in its classpath, as of it depends on the compiled classes from a preceding wsdl2java run. Right now, it seems, it does not.

        Activity

        Hide
        Kirstin Ebeling added a comment -

        I now use this great plugin in my webservice project and had also this problem:

        [INFO] [axistools:admin

        {execution: publish_NLServer_2_server_config_wsdd}

        ]
        08.07.2011 15:49:43 org.apache.axis.deployment.wsdd.WSDDService deployTypeMapping
        SCHWERWIEGEND: Unable to deploy typemapping:

        {http://neolink.ws.gpunkt.com}

        ArrayOf_tns8_IntegerWithAbsolutCount
        java.lang.ClassNotFoundException: [Lcom.gpunkt.ws.neolink.model.query.IntegerWithAbsolutCount;
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:187)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
        at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
        at org.apache.axis.deployment.wsdd.WSDDTypeMapping.getLanguageSpecificType(WSDDTypeMapping.java:183)
        at org.apache.axis.deployment.wsdd.WSDDService.deployTypeMapping(WSDDService.java:542)
        at org.apache.axis.deployment.wsdd.WSDDService.initTMR(WSDDService.java:253)
        at org.apache.axis.deployment.wsdd.WSDDService.<init>(WSDDService.java:233)
        at org.apache.axis.deployment.wsdd.WSDDDeployment.<init>(WSDDDeployment.java:192)
        at org.apache.axis.deployment.wsdd.WSDDDocument.<init>(WSDDDocument.java:78)
        at org.apache.axis.utils.Admin.processWSDD(Admin.java:111)
        at org.apache.axis.utils.Admin.process(Admin.java:158)
        at org.codehaus.mojo.axistools.admin.AdminWrapper.execute(AdminWrapper.java:83)
        at org.codehaus.mojo.axistools.admin.DefaultAdminPlugin.execute(DefaultAdminPlugin.java:94)
        at org.codehaus.mojo.axistools.AdminMojo.execute(AdminMojo.java:90)
        ...

        Because I need a solution, I checked out axistools-maven-plugin from svn and insert following method (first in DefaultAdminPlugin.java, but in the end in AbstractAxisPlugin - so it works for all goals)

        public void addURLToSystemClassLoader(URL url)
        throws IntrospectionException {
        URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader
        .getSystemClassLoader();
        Class classLoaderClass = URLClassLoader.class;

        try {
        Method method = classLoaderClass.getDeclaredMethod("addURL",
        new Class[]

        { URL.class }

        );
        method.setAccessible(true);
        method.invoke(systemClassLoader, new Object[]

        { url }

        );
        } catch (Throwable t)

        { t.printStackTrace(); throw new IntrospectionException( "Error when adding url to system ClassLoader "); }

        }

        I used this method at the begin of method execute:

        public void execute() throws AxisPluginException {
        //add project classpath elements to mojo classpath
        try {
        if((project!=null)&&(project.getCompileClasspathElements()!=null)){
        for (int index = 0; index < project.getCompileClasspathElements()
        .size(); index++)

        { String path = (String) project.getCompileClasspathElements() .get(index); URL cpUrl = new File(path).toURL(); addURLToSystemClassLoader(cpUrl); }

        }
        } catch (MalformedURLException e)

        { getLog().warn("Can't add compile classpath elements to mojo!",e); } catch (DependencyResolutionRequiredException e) { getLog().warn("Can't add compile classpath elements to mojo!",e); }

        catch (IntrospectionException e)

        { getLog().warn("Can't add compile classpath elements to mojo!",e); }


        }

        In subclasses of AbsractAxisPlugin I insert the call "super.execute()" at the begin of execute()-method.

        This works fine. Would you please insert this in your project, so all user of your plugin (I too) can access and use this?

        Show
        Kirstin Ebeling added a comment - I now use this great plugin in my webservice project and had also this problem: [INFO] [axistools:admin {execution: publish_NLServer_2_server_config_wsdd} ] 08.07.2011 15:49:43 org.apache.axis.deployment.wsdd.WSDDService deployTypeMapping SCHWERWIEGEND: Unable to deploy typemapping: {http://neolink.ws.gpunkt.com} ArrayOf_tns8_IntegerWithAbsolutCount java.lang.ClassNotFoundException: [Lcom.gpunkt.ws.neolink.model.query.IntegerWithAbsolutCount; at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:187) at java.security.AccessController.doPrivileged(Native Method) at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160) at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100) at org.apache.axis.deployment.wsdd.WSDDTypeMapping.getLanguageSpecificType(WSDDTypeMapping.java:183) at org.apache.axis.deployment.wsdd.WSDDService.deployTypeMapping(WSDDService.java:542) at org.apache.axis.deployment.wsdd.WSDDService.initTMR(WSDDService.java:253) at org.apache.axis.deployment.wsdd.WSDDService.<init>(WSDDService.java:233) at org.apache.axis.deployment.wsdd.WSDDDeployment.<init>(WSDDDeployment.java:192) at org.apache.axis.deployment.wsdd.WSDDDocument.<init>(WSDDDocument.java:78) at org.apache.axis.utils.Admin.processWSDD(Admin.java:111) at org.apache.axis.utils.Admin.process(Admin.java:158) at org.codehaus.mojo.axistools.admin.AdminWrapper.execute(AdminWrapper.java:83) at org.codehaus.mojo.axistools.admin.DefaultAdminPlugin.execute(DefaultAdminPlugin.java:94) at org.codehaus.mojo.axistools.AdminMojo.execute(AdminMojo.java:90) ... Because I need a solution, I checked out axistools-maven-plugin from svn and insert following method (first in DefaultAdminPlugin.java, but in the end in AbstractAxisPlugin - so it works for all goals) public void addURLToSystemClassLoader(URL url) throws IntrospectionException { URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader .getSystemClassLoader(); Class classLoaderClass = URLClassLoader.class; try { Method method = classLoaderClass.getDeclaredMethod("addURL", new Class[] { URL.class } ); method.setAccessible(true); method.invoke(systemClassLoader, new Object[] { url } ); } catch (Throwable t) { t.printStackTrace(); throw new IntrospectionException( "Error when adding url to system ClassLoader "); } } I used this method at the begin of method execute: public void execute() throws AxisPluginException { //add project classpath elements to mojo classpath try { if((project!=null)&&(project.getCompileClasspathElements()!=null)){ for (int index = 0; index < project.getCompileClasspathElements() .size(); index++) { String path = (String) project.getCompileClasspathElements() .get(index); URL cpUrl = new File(path).toURL(); addURLToSystemClassLoader(cpUrl); } } } catch (MalformedURLException e) { getLog().warn("Can't add compile classpath elements to mojo!",e); } catch (DependencyResolutionRequiredException e) { getLog().warn("Can't add compile classpath elements to mojo!",e); } catch (IntrospectionException e) { getLog().warn("Can't add compile classpath elements to mojo!",e); } } In subclasses of AbsractAxisPlugin I insert the call "super.execute()" at the begin of execute()-method. This works fine. Would you please insert this in your project, so all user of your plugin (I too) can access and use this?
        Hide
        James Gilbertson added a comment -

        I've submitted a simple patch that:

        • adds a method (getCompileScopeClassLoader) to AbstractAxisPlugin to create a ClassLoader that uses the project's compile classpath
        • updates DefaultAdminPlugin to change the current thread's classloader to a compile scoped one before calling Axis and then restore the previous classloader after wards
        Show
        James Gilbertson added a comment - I've submitted a simple patch that: adds a method (getCompileScopeClassLoader) to AbstractAxisPlugin to create a ClassLoader that uses the project's compile classpath updates DefaultAdminPlugin to change the current thread's classloader to a compile scoped one before calling Axis and then restore the previous classloader after wards

          People

          • Assignee:
            Unassigned
            Reporter:
            Rick Janda
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: