You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Zachary Jones (JIRA)" <ji...@codehaus.org> on 2007/02/22 13:01:27 UTC
[jira] Created: (SUREFIRE-289) Surefire classlaoder loads wrong
class when classes are of same package/class name
Surefire classlaoder loads wrong class when classes are of same package/class name
----------------------------------------------------------------------------------
Key: SUREFIRE-289
URL: http://jira.codehaus.org/browse/SUREFIRE-289
Project: Maven Surefire
Issue Type: Bug
Components: classloading
Affects Versions: 2.0 (2.2 plugin)
Environment: Windows, Cygwin
Reporter: Zachary Jones
This is a repeat of the comment in SUREFIRE-286
I am having a problem with surefire classloading.
I had to hack the ServiceMix class:
org.apache.servicemix.http.processors.ConsumerProcessor.
I saved the hacked version as the same class name and the same package. This class does compile to target/classes. The ServiceMix jar that contains this class is included in my classpath after the target/classes directory (seen with -X)
When running mvn test, I get a test failure for the Test class that tries to create a ConsumerProcessor. We are expecting it to create "our" version of ConsumerProcessor, but it instead creates the ServiceMix version.
I have tried all the available usage options from the surefire plugin documentation to no avail. Through debug in Eclipse, I see through a watch expression (getClass().getClassLoader()) is always the IsolatedClassLoader, no matter what options we set.
This test passes in Eclipse, so I am pretty sure it is a classloading issue with the surefire plugin.
Thanks for your help in advance.
--
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: (SUREFIRE-289) Surefire classlaoder loads wrong
class when classes are of same package/class name
Posted by "Michael Joyce (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_99584 ]
Michael Joyce commented on SUREFIRE-289:
----------------------------------------
This appears to be a duplicate of SUREFIRE-61
> Surefire classlaoder loads wrong class when classes are of same package/class name
> ----------------------------------------------------------------------------------
>
> Key: SUREFIRE-289
> URL: http://jira.codehaus.org/browse/SUREFIRE-289
> Project: Maven Surefire
> Issue Type: Bug
> Components: classloading
> Affects Versions: 2.0 (2.2 plugin)
> Environment: Windows, Cygwin
> Reporter: Zachary Jones
> Fix For: 2.4
>
> Attachments: cheese.zip, cheesetest.zip
>
>
> This is a repeat of the comment in SUREFIRE-286
> I am having a problem with surefire classloading.
> I had to hack the ServiceMix class:
> org.apache.servicemix.http.processors.ConsumerProcessor.
> I saved the hacked version as the same class name and the same package. This class does compile to target/classes. The ServiceMix jar that contains this class is included in my classpath after the target/classes directory (seen with -X)
> When running mvn test, I get a test failure for the Test class that tries to create a ConsumerProcessor. We are expecting it to create "our" version of ConsumerProcessor, but it instead creates the ServiceMix version.
> I have tried all the available usage options from the surefire plugin documentation to no avail. Through debug in Eclipse, I see through a watch expression (getClass().getClassLoader()) is always the IsolatedClassLoader, no matter what options we set.
> This test passes in Eclipse, so I am pretty sure it is a classloading issue with the surefire plugin.
> Thanks for your help in advance.
--
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: (SUREFIRE-289) Surefire classlaoder loads wrong
class when classes are of same package/class name
Posted by "Zachary Jones (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zachary Jones updated SUREFIRE-289:
-----------------------------------
Attachment: cheesetest.zip
cheese.zip
Adding a test case to prove this problem.
First unzip the cheese.zip into your local repo. It contains a jar file at cheese/org/cheeseburgertest-1.0.jar
cheeseburgertest-1.0.jar contains a class "test/TestClass" that has a method String sayCheese() which returns "CheeseBurger!".
Unizip the cheesetest.zip anywhere and run "mvn install". cheesetest is a simple project that contains a duplicate "test/TestClass" whose sayCheese method returns "Cheese!".
When it runs the test "test/TestClassTest", it asserts that sayCheese returns "Cheese!". But as you will see, the test fails and the surefire report shows "CheeseBurger!" was returned instead.
If you do an eclipse:eclipse and run the test in Eclipse, the test will pass as expected..
> Surefire classlaoder loads wrong class when classes are of same package/class name
> ----------------------------------------------------------------------------------
>
> Key: SUREFIRE-289
> URL: http://jira.codehaus.org/browse/SUREFIRE-289
> Project: Maven Surefire
> Issue Type: Bug
> Components: classloading
> Affects Versions: 2.0 (2.2 plugin)
> Environment: Windows, Cygwin
> Reporter: Zachary Jones
> Attachments: cheese.zip, cheesetest.zip
>
>
> This is a repeat of the comment in SUREFIRE-286
> I am having a problem with surefire classloading.
> I had to hack the ServiceMix class:
> org.apache.servicemix.http.processors.ConsumerProcessor.
> I saved the hacked version as the same class name and the same package. This class does compile to target/classes. The ServiceMix jar that contains this class is included in my classpath after the target/classes directory (seen with -X)
> When running mvn test, I get a test failure for the Test class that tries to create a ConsumerProcessor. We are expecting it to create "our" version of ConsumerProcessor, but it instead creates the ServiceMix version.
> I have tried all the available usage options from the surefire plugin documentation to no avail. Through debug in Eclipse, I see through a watch expression (getClass().getClassLoader()) is always the IsolatedClassLoader, no matter what options we set.
> This test passes in Eclipse, so I am pretty sure it is a classloading issue with the surefire plugin.
> Thanks for your help in advance.
--
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: (SUREFIRE-289) Surefire classlaoder loads wrong
class when classes are of same package/class name
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brett Porter updated SUREFIRE-289:
----------------------------------
Fix Version/s: 2.4
> Surefire classlaoder loads wrong class when classes are of same package/class name
> ----------------------------------------------------------------------------------
>
> Key: SUREFIRE-289
> URL: http://jira.codehaus.org/browse/SUREFIRE-289
> Project: Maven Surefire
> Issue Type: Bug
> Components: classloading
> Affects Versions: 2.0 (2.2 plugin)
> Environment: Windows, Cygwin
> Reporter: Zachary Jones
> Fix For: 2.4
>
> Attachments: cheese.zip, cheesetest.zip
>
>
> This is a repeat of the comment in SUREFIRE-286
> I am having a problem with surefire classloading.
> I had to hack the ServiceMix class:
> org.apache.servicemix.http.processors.ConsumerProcessor.
> I saved the hacked version as the same class name and the same package. This class does compile to target/classes. The ServiceMix jar that contains this class is included in my classpath after the target/classes directory (seen with -X)
> When running mvn test, I get a test failure for the Test class that tries to create a ConsumerProcessor. We are expecting it to create "our" version of ConsumerProcessor, but it instead creates the ServiceMix version.
> I have tried all the available usage options from the surefire plugin documentation to no avail. Through debug in Eclipse, I see through a watch expression (getClass().getClassLoader()) is always the IsolatedClassLoader, no matter what options we set.
> This test passes in Eclipse, so I am pretty sure it is a classloading issue with the surefire plugin.
> Thanks for your help in advance.
--
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: (SUREFIRE-289) Surefire classlaoder loads wrong
class when classes are of same package/class name
Posted by "Dan Fabulich (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Fabulich closed SUREFIRE-289.
---------------------------------
Resolution: Duplicate
Fix Version/s: (was: 2.4)
duplicate of SUREFIRE-61
> Surefire classlaoder loads wrong class when classes are of same package/class name
> ----------------------------------------------------------------------------------
>
> Key: SUREFIRE-289
> URL: http://jira.codehaus.org/browse/SUREFIRE-289
> Project: Maven Surefire
> Issue Type: Bug
> Components: classloading
> Affects Versions: 2.0 (2.2 plugin)
> Environment: Windows, Cygwin
> Reporter: Zachary Jones
> Attachments: cheese.zip, cheesetest.zip
>
>
> This is a repeat of the comment in SUREFIRE-286
> I am having a problem with surefire classloading.
> I had to hack the ServiceMix class:
> org.apache.servicemix.http.processors.ConsumerProcessor.
> I saved the hacked version as the same class name and the same package. This class does compile to target/classes. The ServiceMix jar that contains this class is included in my classpath after the target/classes directory (seen with -X)
> When running mvn test, I get a test failure for the Test class that tries to create a ConsumerProcessor. We are expecting it to create "our" version of ConsumerProcessor, but it instead creates the ServiceMix version.
> I have tried all the available usage options from the surefire plugin documentation to no avail. Through debug in Eclipse, I see through a watch expression (getClass().getClassLoader()) is always the IsolatedClassLoader, no matter what options we set.
> This test passes in Eclipse, so I am pretty sure it is a classloading issue with the surefire plugin.
> Thanks for your help in advance.
--
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