You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Carlos Sanchez (JIRA)" <ji...@codehaus.org> on 2006/04/13 20:17:48 UTC

[jira] Created: (MNG-2225) Classloader problem when adding jars to M2_HOME

Classloader problem when adding jars to M2_HOME
-----------------------------------------------

         Key: MNG-2225
         URL: http://jira.codehaus.org/browse/MNG-2225
     Project: Maven 2
        Type: Bug

  Components: Dependencies  
    Versions: 2.0.4    
    Reporter: Carlos Sanchez
    Priority: Critical
     Fix For: 2.0.5
 Attachments: testwagonscm.tgz

Added these jars to M2_HOME/custom to allow using scm based remote repos

http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar


bin/m2.conf

main is org.apache.maven.cli.MavenCli from plexus.core.maven

set maven.home default ${user.home}/m2

[plexus.core]
load ${maven.home}/core/*.jar

[plexus.core.maven]
load ${maven.home}/custom/*.jar
load ${maven.home}/lib/*.jar




When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MNG-2225) Classloader problem when adding jars to M2_HOME

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2225?page=comments#action_63539 ] 

Brett Porter commented on MNG-2225:
-----------------------------------

it's currently in code, would be good to push to configuration.

> Classloader problem when adding jars to M2_HOME
> -----------------------------------------------
>
>          Key: MNG-2225
>          URL: http://jira.codehaus.org/browse/MNG-2225
>      Project: Maven 2
>         Type: Bug

>   Components: Dependencies
>     Versions: 2.0.4
>     Reporter: Carlos Sanchez
>     Priority: Critical
>      Fix For: 2.0.5
>  Attachments: testwagonscm.tgz
>
>
> Added these jars to M2_HOME/custom to allow using scm based remote repos
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
> http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar
> bin/m2.conf
> main is org.apache.maven.cli.MavenCli from plexus.core.maven
> set maven.home default ${user.home}/m2
> [plexus.core]
> load ${maven.home}/core/*.jar
> [plexus.core.maven]
> load ${maven.home}/custom/*.jar
> load ${maven.home}/lib/*.jar
> When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MNG-2225) Classloader problem when adding jars to M2_HOME

Posted by "Carlos Sanchez (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2225?page=all ]

Carlos Sanchez updated MNG-2225:
--------------------------------

    Testcase included: yes
          Fix Version: 2.0.5

> Classloader problem when adding jars to M2_HOME
> -----------------------------------------------
>
>          Key: MNG-2225
>          URL: http://jira.codehaus.org/browse/MNG-2225
>      Project: Maven 2
>         Type: Bug

>   Components: Dependencies
>     Versions: 2.0.4
>     Reporter: Carlos Sanchez
>     Priority: Critical
>      Fix For: 2.0.5
>  Attachments: testwagonscm.tgz
>
>
> Added these jars to M2_HOME/custom to allow using scm based remote repos
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
> http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar
> bin/m2.conf
> main is org.apache.maven.cli.MavenCli from plexus.core.maven
> set maven.home default ${user.home}/m2
> [plexus.core]
> load ${maven.home}/core/*.jar
> [plexus.core.maven]
> load ${maven.home}/custom/*.jar
> load ${maven.home}/lib/*.jar
> When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MNG-2225) Classloader problem when adding jars to M2_HOME

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2225?page=comments#action_63536 ] 

Brett Porter commented on MNG-2225:
-----------------------------------

you need to filter anything in lib (or custom) from turning up in plugins (in the plugin manager).

So replacing anything in lib by putting it in custom is fine, but adding stuff is not.

> Classloader problem when adding jars to M2_HOME
> -----------------------------------------------
>
>          Key: MNG-2225
>          URL: http://jira.codehaus.org/browse/MNG-2225
>      Project: Maven 2
>         Type: Bug

>   Components: Dependencies
>     Versions: 2.0.4
>     Reporter: Carlos Sanchez
>     Priority: Critical
>      Fix For: 2.0.5
>  Attachments: testwagonscm.tgz
>
>
> Added these jars to M2_HOME/custom to allow using scm based remote repos
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
> http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar
> bin/m2.conf
> main is org.apache.maven.cli.MavenCli from plexus.core.maven
> set maven.home default ${user.home}/m2
> [plexus.core]
> load ${maven.home}/core/*.jar
> [plexus.core.maven]
> load ${maven.home}/custom/*.jar
> load ${maven.home}/lib/*.jar
> When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MNG-2225) Classloader problem when adding jars to M2_HOME

Posted by "John Casey (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Casey closed MNG-2225.
---------------------------

         Assignee: John Casey
       Resolution: Fixed
    Fix Version/s:     (was: 2.1)
                   2.1-alpha-1

You should be able to bring in any extras now using the build extension mechanism, and only the extension components themselves will be added to the core container realm. As long as these components implement interfaces already present in the core realm, or (I suppose) represent themselves (i.e. they aren't going to be referenced by some interface they bring along in their jar) they should be available without problem.

Dependencies of these extension components are actually loaded into a per-extension realm, and the ext. component classes are imported from that realm into a project-specific realm that inherits from the core realm. This means that the core realm is available, as are the ext. components. However, the ext dependencies are isolated in their own realm, where only those ext components have access to them.

There should be no need to modify the ${maven.home}/lib directory now, since you can specify these extensions at the parent-pom level.

> Classloader problem when adding jars to M2_HOME
> -----------------------------------------------
>
>                 Key: MNG-2225
>                 URL: http://jira.codehaus.org/browse/MNG-2225
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 2.0.4
>            Reporter: Carlos Sanchez
>            Assignee: John Casey
>            Priority: Critical
>             Fix For: 2.1-alpha-1
>
>         Attachments: testwagonscm.tgz
>
>
> Added these jars to M2_HOME/custom to allow using scm based remote repos
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
> http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar
> bin/m2.conf
> main is org.apache.maven.cli.MavenCli from plexus.core.maven
> set maven.home default ${user.home}/m2
> [plexus.core]
> load ${maven.home}/core/*.jar
> [plexus.core.maven]
> load ${maven.home}/custom/*.jar
> load ${maven.home}/lib/*.jar
> When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-2225) Classloader problem when adding jars to M2_HOME

Posted by "Kenney Westerhof (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2225?page=comments#action_83247 ] 
            
Kenney Westerhof commented on MNG-2225:
---------------------------------------

It would be better if mojo dependencies took precedence over those in the core realm, especially with all the plexus-utils problems.

Mojo's should be able to use any component version they desire. Only core components api's that are already used by the maven
core should take precedence; in this case only maven-project, maven-plugin-api and possibly maven-artifact; the rest is not needed
and can be replaced by custom versions used by mojo's.

it comes down to limiting items in mojo's parent classloader to ONLY the interfaces/instances that maven core uses and cannot
be replaced. These are: (amongst others):

* MavenProject
* ArtifactFactory
* ArtifactResolution stuff

this list should be as small as possible - no implementations whatsoever should be exported to mojo's.
Here's the current list:
|| Loc   || Artifact || Export to Mojo ||
| core/ |plexus-component-api-1.0-alpha-13.jar | (-) |
| core/ |plexus-container-default-1.0-alpha-14.jar| (-) |
| core/ |plexus-utils-1.1.jar| (-) |
| core/boot | plexus-classworlds-1.2-alpha-5.jar| (-) |
| lib/ |commons-cli-1.0.jar | (-) |
| lib/ |doxia-sink-api-1.0-alpha-9-20061107.221350-3.jar | (-) |
| lib/ |jsch-0.1.27.jar | (-) |
| lib/ |jtidy-4aug2000r7-dev.jar | (-) |
| lib/ |maven-artifact-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-artifact-manager-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-cli-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-core-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-embedder-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-error-diagnostics-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-model-2.1-SNAPSHOT.jar | (+) |
| lib/ |maven-monitor-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-plugin-api-2.1-SNAPSHOT.jar | (+) |
| lib/ |maven-plugin-descriptor-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-plugin-parameter-documenter-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-plugin-registry-2.1-SNAPSHOT.jar | (?) |
| lib/ |maven-profile-2.1-SNAPSHOT.jar | (?) |
| lib/ |maven-project-2.1-SNAPSHOT.jar | (+) |
| lib/ |maven-reporting-api-2.1-SNAPSHOT.jar | (+) |
| lib/ |maven-repository-metadata-2.1-SNAPSHOT.jar | (-) |
| lib/ |maven-settings-2.1-SNAPSHOT.jar | (?) |
| lib/ |maven-tools-2.1-SNAPSHOT.jar | (?) |
| lib/ |plexus-interactivity-api-1.0-alpha-4.jar | (-) |
| lib/ |wagon-file-1.0-beta-2.jar | (-) |
| lib/ |wagon-http-lightweight-1.0-beta-2.jar | (-) |
| lib/ |wagon-http-shared-1.0-beta-2.jar | (-) |
| lib/ |wagon-provider-api-1.0-beta-2.jar | (?) |
| lib/ |wagon-ssh-1.0-beta-2.jar  | (-) |
| lib/ |wagon-ssh-common-1.0-beta-2.jar | (-) |
| lib/ |wagon-ssh-external-1.0-beta-2.jar | (-) |
| lib/ |xml-apis-1.0.b2.jar | (-) |

So basically everything that's maven-version specific - only APIs, modello models and in this case also MavenProject since it 
contains the runtime project representation.

I think this is easily solved by updating the m2.conf and add another classloader.

> Classloader problem when adding jars to M2_HOME
> -----------------------------------------------
>
>                 Key: MNG-2225
>                 URL: http://jira.codehaus.org/browse/MNG-2225
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 2.0.4
>            Reporter: Carlos Sanchez
>            Priority: Critical
>             Fix For: 2.1
>
>         Attachments: testwagonscm.tgz
>
>
> Added these jars to M2_HOME/custom to allow using scm based remote repos
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
> http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar
> bin/m2.conf
> main is org.apache.maven.cli.MavenCli from plexus.core.maven
> set maven.home default ${user.home}/m2
> [plexus.core]
> load ${maven.home}/core/*.jar
> [plexus.core.maven]
> load ${maven.home}/custom/*.jar
> load ${maven.home}/lib/*.jar
> When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-2225) Classloader problem when adding jars to M2_HOME

Posted by "John Casey (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2225?page=all ]

John Casey updated MNG-2225:
----------------------------

    Fix Version:     (was: 2.0.5)
                 2.1

this will mean changing the way we build the list of artifacts to filter out of the resolution process (because they're already in the core classloader). We'll have to find a dynamic way to manage that, which might mean installing an internal local repository for Maven itself, so we can build up an index of artifacts that are in there.

Any way we go, it represents new design to solve this problem. I think it would be better to do this in the context of design for customizing maven instances, currently planned for 2.1.

> Classloader problem when adding jars to M2_HOME
> -----------------------------------------------
>
>          Key: MNG-2225
>          URL: http://jira.codehaus.org/browse/MNG-2225
>      Project: Maven 2
>         Type: Bug

>   Components: Dependencies
>     Versions: 2.0.4
>     Reporter: Carlos Sanchez
>     Priority: Critical
>      Fix For: 2.1
>  Attachments: testwagonscm.tgz
>
>
> Added these jars to M2_HOME/custom to allow using scm based remote repos
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
> http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar
> bin/m2.conf
> main is org.apache.maven.cli.MavenCli from plexus.core.maven
> set maven.home default ${user.home}/m2
> [plexus.core]
> load ${maven.home}/core/*.jar
> [plexus.core.maven]
> load ${maven.home}/custom/*.jar
> load ${maven.home}/lib/*.jar
> When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MNG-2225) Classloader problem when adding jars to M2_HOME

Posted by "Carlos Sanchez (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2225?page=comments#action_63538 ] 

Carlos Sanchez commented on MNG-2225:
-------------------------------------

do you mean tweaking the PluginManager code or configuration?

> Classloader problem when adding jars to M2_HOME
> -----------------------------------------------
>
>          Key: MNG-2225
>          URL: http://jira.codehaus.org/browse/MNG-2225
>      Project: Maven 2
>         Type: Bug

>   Components: Dependencies
>     Versions: 2.0.4
>     Reporter: Carlos Sanchez
>     Priority: Critical
>      Fix For: 2.0.5
>  Attachments: testwagonscm.tgz
>
>
> Added these jars to M2_HOME/custom to allow using scm based remote repos
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-api/1.0-beta-2/maven-scm-api-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.0-beta-2/maven-scm-manager-plexus-1.0-beta-2.jar
> http://www.ibiblio.org/maven2/org/apache/maven/scm/maven-scm-provider-svn/1.0-beta-2/maven-scm-provider-svn-1.0-beta-2.jar
> http://cvs.apache.org/maven-snapshot-repository/org/apache/maven/wagon/wagon-scm/1.0-alpha-7-SNAPSHOT/wagon-scm-1.0-alpha-7-20060308.183410-3.jar
> bin/m2.conf
> main is org.apache.maven.cli.MavenCli from plexus.core.maven
> set maven.home default ${user.home}/m2
> [plexus.core]
> load ${maven.home}/core/*.jar
> [plexus.core.maven]
> load ${maven.home}/custom/*.jar
> load ${maven.home}/lib/*.jar
> When running "mvn install" and "mvn testwagonscm:test" in the attached test case you get a ClassCastException although the Class to assign to and the assigned one are the same. The problem seems to be that they come from different classloaders. This problem makes the project-info-report:scm goal fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira