History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: MNG-1898
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Unassigned
Reporter: Brian Fox
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Maven 2

Plugin classpath broken from 2.0 to 2.0.1

Created: 26/Dec/05 10:36 PM   Updated: 30/Dec/06 10:56 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.3

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive automatedTestCase.zip (239 kb)
2. GZip Archive it0100.tar.gz (3 kb)
3. File MNG-1898-coreit.tar.bz2 (6 kb)
4. Text File mng-1898-for-2.1-take2.patch (3 kb)
5. Zip Archive test-1.0.zip (232 kb)
6. Zip Archive test-case.zip (5 kb)

Environment: winxp
Issue Links:
Related
 

Complexity: Expert


 Description  « Hide
I'm working on a kodo plugin in the codehaus mojo sandbox. Using 2.0, it works fine. In 2.1, it can't find xercesImpl, which is a transitive dependency of the plugin. Did something change to cause new behavior (aka a bug) related to this? Just eyeballing the info below, in 2.0, the instance of classloader was org.codehaus.classworlds.RealmClassLoader but in 2.0.1 it is org.codehaus.plexus.util.RealmDelegatingClassLoader

I tried specifying xercesImpl as a direct dependency and that didn't work either so I'm not sure it's related to the transitivity.

Output from 2.0.1: (2.0 follows further below)

[DEBUG] org.codehaus.mojo:kodo-maven-plugin:maven-plugin:1.0-alpha-1-SNAPSHOT (selected for runtime)
[DEBUG] org.apache.maven:maven-model:jar:2.0 (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4 (selected for runtime)
[DEBUG] Skipping disabled repository snapshots
[DEBUG] com.solarmetric:kodo-jdo:jar:3.3.3 (setting version to: 3.3.3 from range: [3.0,])
[DEBUG] com.solarmetric:kodo-jdo:jar:3.3.3 (selected for runtime)
[DEBUG] com.solarmetric:kodo-wl81manage:jar:1.0 (selected for runtime)
[DEBUG] com.solarmetric:kodo-workbench:jar:1.0 (selected for runtime)
[DEBUG] org.hsqldb:jdbc-hsql:jar:1.7.0 (selected for runtime)
[DEBUG] sqlline:sqlline:jar:1.0 (selected for runtime)
[DEBUG] jcommon:jcommon:jar:0.9.1 (selected for runtime)
[DEBUG] javax.jdo:jdo:jar:1.0.2 (selected for runtime)
[DEBUG] xalan:xalan:jar:2.5.1 (selected for runtime)
[DEBUG] jfreechart:jfreechart:jar:0.9.16 (selected for runtime)
[DEBUG] com.solarmetric:kodo-jdo-runtime:jar:3.3.3 (selected for runtime)
[DEBUG] javax.sql:jdbc-stdext:jar:2.0 (selected for runtime)
[DEBUG] jline:jline:jar:0.9.1 (selected for runtime)
[DEBUG] mx4j:mx4j-jmx:jar:1.1.1 (selected for runtime)
[DEBUG] jta-spec:jta-spec:jar:1.0.1 (selected for runtime)
[WARNING] While downloading xml-apis:xml-apis:2.0.0
This artifact has been relocated to xml-apis:xml-apis:1.0.b2.

[DEBUG] xml-apis:xml-apis:jar:1.0.b2 (selected for runtime)
[DEBUG] xerces:xercesImpl:jar:2.5.0 (selected for runtime)
[DEBUG] jca:jca:jar:1.0.0 (selected for runtime)
[DEBUG] mx4j:mx4j-tools:jar:1.1.1 (selected for runtime)
[DEBUG] jndi:jndi:jar:1.2.1 (selected for runtime)
[DEBUG] Skipping disabled repository snapshots
[DEBUG] log4j:log4j:jar:1.2.12 (setting version to: 1.2.12 from range: [1.2.9,])
[DEBUG] log4j:log4j:jar:1.2.12 (selected for runtime)
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0 (selected for runtime)
[DEBUG] Configuring mojo 'org.codehaus.mojo:kodo-maven-plugin:1.0-alpha-1-SNAPSHOT:enhance' -->
[DEBUG] (f) classDir = E:\STC\svn\modules\services\supplementaldata-jdo\trunk\target\classes
[DEBUG] (f) resources = [org.apache.maven.model.Resource@acb158]
[DEBUG] (f) searchDir = E:\STC\svn\modules\services\supplementaldata-jdo\trunk\target\classes
[DEBUG] – end configuration –
[INFO] [kodo:enhance {execution: kodo-enhance}]
[info] Found file:E:\STC\svn\modules\services\supplementaldata-jdo\trunk\target\classes\com\stchome\application\supplementalforms\persist\persist.jdo
[info] org.codehaus.plexus.util.RealmDelegatingClassLoader@16dfa45
[debug] Added to Classpath:
[debug] /E:/STC/svn/modules/services/supplementaldata-jdo/trunk/src/main/resources/
[debug] /E:/STC/svn/modules/services/supplementaldata-jdo/trunk/target/classes/
[INFO] ----------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ----------------------------------------------------------------------------
[INFO] Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
[INFO] ----------------------------------------------------------------------------
[DEBUG] Trace
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:93)
at serp.xml.XMLFactory.checkSAXCache(XMLFactory.java:217)
at serp.xml.XMLFactory.getSAXParser(XMLFactory.java:66)
at com.solarmetric.meta.XMLMetaDataParser.parseNew(XMLMetaDataParser.java:354)
at com.solarmetric.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:320)
at com.solarmetric.meta.ClassArgParser.getFromMetaData(ClassArgParser.java:182)
at com.solarmetric.meta.ClassArgParser.parseClassNames(ClassArgParser.java:98)
at com.solarmetric.meta.ClassArgParser.parseClasses(ClassArgParser.java:74)
at kodo.enhance.JDOEnhancer.run(JDOEnhancer.java:2657)

2.0 Output:
[DEBUG] org.codehaus.mojo:kodo-maven-plugin:maven-plugin:1.0-alpha-1-SNAPSHOT (selected for runtime)
[DEBUG] org.apache.maven:maven-model:jar:2.0 (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4 (selected for runtime)
[DEBUG] Skipping disabled repository snapshots
[DEBUG] com.solarmetric:kodo-jdo:jar:3.3.3 (setting version to: 3.3.3 from range: [3.0,])
[DEBUG] com.solarmetric:kodo-jdo:jar:3.3.3 (selected for runtime)
[DEBUG] com.solarmetric:kodo-wl81manage:jar:1.0 (selected for runtime)
[DEBUG] com.solarmetric:kodo-workbench:jar:1.0 (selected for runtime)
[DEBUG] org.hsqldb:jdbc-hsql:jar:1.7.0 (selected for runtime)
[DEBUG] sqlline:sqlline:jar:1.0 (selected for runtime)
[DEBUG] jcommon:jcommon:jar:0.9.1 (selected for runtime)
[DEBUG] javax.jdo:jdo:jar:1.0.2 (selected for runtime)
[DEBUG] xalan:xalan:jar:2.5.1 (selected for runtime)
[DEBUG] jfreechart:jfreechart:jar:0.9.16 (selected for runtime)
[DEBUG] com.solarmetric:kodo-jdo-runtime:jar:3.3.3 (selected for runtime)
[DEBUG] javax.sql:jdbc-stdext:jar:2.0 (selected for runtime)
[DEBUG] jline:jline:jar:0.9.1 (selected for runtime)
[DEBUG] mx4j:mx4j-jmx:jar:1.1.1 (selected for runtime)
[DEBUG] jta-spec:jta-spec:jar:1.0.1 (selected for runtime)
[WARNING]
This artifact has been relocated to xml-apis:xml-apis:1.0.b2.

[DEBUG] xml-apis:xml-apis:jar:1.0.b2 (selected for runtime)
[DEBUG] xerces:xercesImpl:jar:2.5.0 (selected for runtime)
[DEBUG] jca:jca:jar:1.0.0 (selected for runtime)
[DEBUG] mx4j:mx4j-tools:jar:1.1.1 (selected for runtime)
[DEBUG] jndi:jndi:jar:1.2.1 (selected for runtime)
[DEBUG] Skipping disabled repository snapshots
[DEBUG] log4j:log4j:jar:1.2.12 (setting version to: 1.2.12 from range: [1.2.9,])
[DEBUG] log4j:log4j:jar:1.2.12 (selected for runtime)
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0 (selected for runtime)
[DEBUG] Configuring mojo 'org.codehaus.mojo:kodo-maven-plugin:1.0-alpha-1-SNAPSHOT:enhance' -->
[DEBUG] (f) classDir = E:\STC\svn\modules\services\supplementaldata-jdo\trunk\target\classes
[DEBUG] (f) resources = [org.apache.maven.model.Resource@39e5b5]
[DEBUG] (f) searchDir = E:\STC\svn\modules\services\supplementaldata-jdo\trunk\target\classes
[DEBUG] – end configuration –
[INFO] [kodo:enhance {execution: kodo-enhance}]
[info] Found file:E:\STC\svn\modules\services\supplementaldata-jdo\trunk\target\classes\com\stchome\application\supplementalforms\persist\persist.jdo
[info] org.codehaus.classworlds.RealmClassLoader@589e56
[debug] Added to Classpath:
[debug] /E:/STC/svn/modules/services/supplementaldata-jdo/trunk/src/main/resources/
[debug] /E:/STC/svn/modules/services/supplementaldata-jdo/trunk/target/classes/
0 INFO [main] kodo.Tool - JDO enhancer running on type "class com.stchome.application.supplementalforms.persist.FormOwnerAssociation".



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brett Porter - 29/Dec/05 12:24 PM
need to review a couple of classloader situations


Brett Porter - 06/Jan/06 05:40 PM
basically we need to:
  • restore compatibility with 2.0 version
  • retain the fix above
  • see if we can improve the classloading situation for things like MCHECKSTYLE-10 so people don't need to create their own classloaders

the original bugfix for 2.0.1 was MNG-1804


John Casey - 10/Jan/06 11:15 PM
I need a test case to verify that this is an issue. Currently, using the descriptions above, and the email message referenced above, I cannot get this to break.

See:

  • it0086
  • it0087
  • it0089

If these are erroneous, I need to figure out why. I'm going to reschedule this to 2.0.3, and close it later if I can't reproduce later.


Brian Fox - 11/Jan/06 07:53 AM
I was really hoping this could get fixed in 2.0.2, I can't proceed with my Kodo plugin until it gets fixed. If there is something I can do to help let me know, the code causing the problem is on mojo.

Brian Fox - 11/Jan/06 02:03 PM
Install the jar in test-1.0.zip to the local repo and build the plugin in test-case. Run the plugin by using mvn test:enhance

In 2.0 it will print where it found the factory class, in 2.0.1 it will crash


Joakim Erdfelt - 16/Jan/06 11:16 AM
Attached: MNG-1898-coreit.tar.bz2

Contains 2 maven-core-it tests to help prevent some specific classloader issues.

Tests both classloader.getResource() techniques.
Using ClassLoaders obtained via

1) Thread.currentThread().getContextClassLoader()
2) this.getClass().getClassLoader()

it0100 - Plugin/Mojo test classloader test.
it0101 - Plugin/Report test classloader test..


Brian Fox - 01/Feb/06 08:22 AM
Any progress on this issue? I would like to move forward with my plugins but can't because of this. We are stuck maintaining a bunch of lame ant scripts in the meantime.

Carlos Sanchez - 08/Feb/06 04:44 PM
Try excluding xml-apis and xerces. That fixed a similar problem for me

Brian Fox - 20/Feb/06 03:01 PM
What's the rational for pushing this off to yet another revision? It's functionality that was clearly broken from the original 2.0 AND it has a test case attached. I was originally told that if I could produce a test case that it would be fixed in 2.0.2.

Carlos Sanchez - 20/Feb/06 03:27 PM
Test case doesn't work, there are missing dependencies

Carlos Sanchez - 20/Feb/06 03:36 PM
Fixed test case

Carlos Sanchez - 20/Feb/06 03:36 PM
Fixed test case

Carlos Sanchez - 20/Feb/06 03:38 PM
I'm unable to reproduce this bug with the test cases either in 2.0.2 and 2.0.3 snapshot
I've attached the test cases with updated pom s so they build

Carlos Sanchez - 20/Feb/06 03:38 PM
BTW the one I tried is MNG-1898-coreit.tar.bz2

Brian Fox - 20/Feb/06 03:46 PM
the IT case came from someone else. I just retried this and was able to reproduce with 2.0.2.

Extract test-1.0.zip to localrepo/test/test/1.0

extract test-case.zip and run: mvn install
then mvn test:enhance


Brian Fox - 20/Feb/06 04:07 PM
Attaching new fully automated test case: automatedTestCase.zip

Unzip and run test.bat (sorry only on windows but you can look at the commands and run on unix, only 3 of them)


Carlos Sanchez - 20/Feb/06 04:27 PM
IT test that breaks under 2.0.3-SNAPSHOT and succeeds under 2.0

Carlos Sanchez - 20/Feb/06 04:30 PM
it0100.tar.gz is the one for maven components\maven-core-it


Brett Porter - 21/Feb/06 05:19 AM
1804 was what introduced the issue.

Brett Porter - 21/Feb/06 05:23 AM
the problem appeared to be that the RealmDelegatingClassLoader included the system classpath, which would have conflicted with Xerces, as best I can guess.

Flipping to realm.getClassLoader() achieves the original aim, while still matching the 2.0 classloader that the plugin was relying on. Fixed in r379425 on trunk.


Brian Fox - 21/Feb/06 09:57 AM
Thank you!

Brian Fox - 11/Dec/06 11:18 PM
attaching patch to fix it0094 for maven 2.1

Carlos Sanchez - 12/Dec/06 04:36 AM
Brian, you need to reopen the issue to bring the attention, if you just comment it can be missed.

> attaching patch to fix it0094 for maven 2.1

It'd be good if you explain why is this patch needed now after 10 months


Brian Fox - 12/Dec/06 09:46 AM
Jason paged me on the dev list to fix the IT test because classworlds changed. I didn't have karma to directly commit so I figured this would be the logical place to attach. Since the actual bug itself was still fixed, it didn't occur to me to reopen.

----Original Message----
From: Jason van Zyl jason@maven.org
Sent: Tuesday, December 12, 2006 2:02 AM
To: Maven Developers List
Subject: Re: it0094 calling Brian Fox

Awesome, thanks. That means the new container works with everything now.

Jason.

On 12 Dec 06, at 12:35 AM 12 Dec 06, Brian E. Fox wrote:

> Hi Jason,
> The fix was easy because the new classworlds is much better than the
> old one. I don't have karma in maven-core so I attached the patch to
> MNG-1898. This patch works with both 2.0.4 and 2.1.
>
> I also came across and patched a bug in the mvn.bat file:
> http://jira.codehaus.org/browse/MNG-2699
>
> -Brian
> ----Original Message----
> From: Jason van Zyl jason@maven.org
> Sent: Sunday, December 10, 2006 7:01 PM
> To: Maven Developers List
> Subject: Re: it0094 calling Brian Fox
>
> On 10 Dec 06, at 6:54 PM 10 Dec 06, Brian E. Fox wrote:
>
>> I can try. Are you saying only the IT is broken and not the
>> functionality?
>>
>
> It's broken because we've changed ClassWorlds and that field does not
> exist anymore
>
> Jason.
>
>> ----Original Message----
>> From: Jason van Zyl jason@maven.org
>> Sent: Sunday, December 10, 2006 4:15 PM
>> To: Maven Developers List
>> Subject: it0094 calling Brian Fox
>>
>> Hi Brian
>>
>> Do you think you might be able to help me with an IT?
>>
>> http://jira.codehaus.org/browse/MNG-1898
>>
>> This originally uses a reflection to grab a private field which no
>> longer exists in classworlds and is breaking the IT in 2.1-SNAPSHOT.
>>
>> Do you think you might try to faithfully reproduce the intent of the
>> IT without grabbing a protected field?
>>
>> That would be most helpful
>>
>> Jason.


Brian Fox - 12/Dec/06 09:49 AM
just for further clarification: all that needs to be done on this issue is to have the mng-1898-for-2.1take2.patch applied against the trunk integration tests. Only the IT was broken, not the real code.

Brett Porter - 30/Dec/06 10:55 PM
re-closing for the original version. Shouldn't reopen stuff fixed in earlier versions - beter to create a new one. I will apply the patch.

Brett Porter - 30/Dec/06 10:56 PM
actually, looks like it was already applied