You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ted Yu <yu...@gmail.com> on 2010/05/14 19:41:36 UTC

unit test not finding dependent class

Hi,
Here is the information about maven I use:

Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
Java version: 1.6.0_17
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"

I see strange unit test failure which was due to a dependent class in the
same package not being found:
java.lang.NoClassDefFoundError:
com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
        at
com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)

In Eclipse, I can successfully run the same unit test.

Can someone provide hint ?

Thanks

Re: unit test not finding dependent class

Posted by Anders Hammar <an...@hammar.net>.
I ran into something similar yesterday (however, in that case it didn't work
with m2e either). The scm used was clearcase (dynamic view) which was likely
causing the problem (it had happened before apparently).
I don't know why, but after several "mvn clean install" and removing the
local repo at least once, I got it to work.

Are you using clearcase?

/Anders

On Tue, May 18, 2010 at 03:44, Wayne Fay <wa...@gmail.com> wrote:

> > We don't use shaded plugin.
>
> Seems like you've exhausted the capabilities of this list without
> providing either more information or more ideally a sample project
> that demonstrates the issue. Can you provide one?
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: unit test not finding dependent class

Posted by Wayne Fay <wa...@gmail.com>.
> We don't use shaded plugin.

Seems like you've exhausted the capabilities of this list without
providing either more information or more ideally a sample project
that demonstrates the issue. Can you provide one?

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: unit test not finding dependent class

Posted by Ted Yu <yu...@gmail.com>.
We don't use shaded plugin.

arvindmac:m2m-platform tyu$ mvn -version
Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
Java version: 1.6.0_17
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"

On Mon, May 17, 2010 at 10:45 AM, Martin Gainty <mg...@hotmail.com> wrote:

>
> Yu
>
>
> Anders..Kalpak and Ron are correct ..changing the package name causes this
> problem
>
> If you disagree.. post your code and pom.xml and settings.xml (and indicate
> which version of maven) so we can download and test your configuration
>
> Are you using the shaded plugin ?
>
>
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>
>
>
> > Date: Mon, 17 May 2010 09:39:47 -0700
> > Subject: Re: unit test not finding dependent class
> > From: yuzhihong@gmail.com
> > To: users@maven.apache.org
> >
> > I abbreviated the company name for privacy.
> > That shouldn't be the cause.
> >
> > On Sun, May 16, 2010 at 2:28 PM, Ron Wheeler <
> rwheeler@artifact-software.com
> > > wrote:
> >
> > > com/iq/m2m/platform/tester/MergePkgsTester
> > > /com/ciq/m2m/platform/tester/MergePkgsTester.class
> > >
> > > 2 different package names
> > > ciq!=iq
> > >
> > > Ron
> > >
> > >
> > > On 16/05/2010 3:41 PM, Ted Yu wrote:
> > >
> > >> The classes are not dynamically loaded.
> > >>
> > >> Thanks
> > >>
> > >> On Sunday, May 16, 2010, Kalpak Gadre<ka...@gmail.com> wrote:
> > >>
> > >>
> > >>> Just in case.. Are you dynamically loading these classes from your
> code?
> > >>>
> > >>> You can see these kind of errors in case you are dynamically loading
> > >>> classes using System class loader instead of the immediate class
> loader. The
> > >>> test runner will segregate the classes by providing a custom class
> loader
> > >>> for each test. All your classes will be added to this child class
> loader. So
> > >>> trying to load classes from System class loader will fail as the
> System
> > >>> class loader does not know about these classes.
> > >>>
> > >>> - Kalpak
> > >>>
> > >>>
> > >>>
> > >>> -rw-r--r-- 1 tyu staff 5691 May 16 08:58
> > >>>
> > >>>
> target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class
> > >>>
> > >>> That test passes.
> > >>>
> > >>> But the same problem appears for other tests:
> > >>> arvindmac:m2m-platform tyu$ vi
> > >>>
> > >>>
> target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt
> > >>>
> > >>> java.lang.NoClassDefFoundError:
> > >>> com/iq/m2m/platform/tester/MergePkgsTester
> > >>>
> > >>> Although the class has been generated:
> > >>> ...
> > >>> -rw-r--r-- 1 tyu staff 5141 May 16 08:58
> > >>> target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class
> > >>>
> > >>> On Sun, May 16, 2010 at 7:16 AM, Anders Hammar<an...@hammar.net>
> > >>> wrote:
> > >>>
> > >>>
> > >>>
> > >>> Is OtaUploadRecordReader a class you've written and that's in the
> same
> > >>> Maven
> > >>> project? If so, check that it is being compiled by checking that the
> > >>> .class
> > >>> file exists under target/classes/
> > >>>
> > >>> If it's not being compiled there's some error you need to fix in your
> > >>> project.
> > >>>
> > >>> /Anders
> > >>>
> > >>> On Fri, May 14, 2010 at 19:41, Ted Yu<yu...@gmail.com> wrote:
> > >>>
> > >>>
> > >>>
> > >>> Hi,
> > >>> Here is the information about maven I use:
> > >>>
> > >>> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
> > >>> Java version: 1.6.0_17
> > >>> Java home:
> > >>>
> > >>>
> > >>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
> > >>>
> > >>>
> > >>> Default locale: en_US, platform encoding: MacRoman
> > >>> OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
> > >>>
> > >>> I see strange unit test failure which was due to a dependent class in
> the
> > >>> same package not being found:
> > >>> java.lang.NoClassDefFoundError:
> > >>> com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
> > >>> at
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
> > >>>
> > >>>
> > >>> In Eclipse, I can successfully run the same unit test.
> > >>>
> > >>> Can someone provide hint ?
> > >>>
> > >>> Thanks
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > >>> For additional commands, e-mail: users-help@maven.apache.org
> > >>>
> > >>>
> > >>>
> > >>>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > >> For additional commands, e-mail: users-help@maven.apache.org
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
>
> _________________________________________________________________
> Hotmail has tools for the New Busy. Search, chat and e-mail from your
> inbox.
>
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
>

RE: unit test not finding dependent class

Posted by Martin Gainty <mg...@hotmail.com>.
Yu


Anders..Kalpak and Ron are correct ..changing the package name causes this problem

If you disagree.. post your code and pom.xml and settings.xml (and indicate which version of maven) so we can download and test your configuration 

Are you using the shaded plugin ?


Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

 

> Date: Mon, 17 May 2010 09:39:47 -0700
> Subject: Re: unit test not finding dependent class
> From: yuzhihong@gmail.com
> To: users@maven.apache.org
> 
> I abbreviated the company name for privacy.
> That shouldn't be the cause.
> 
> On Sun, May 16, 2010 at 2:28 PM, Ron Wheeler <rwheeler@artifact-software.com
> > wrote:
> 
> > com/iq/m2m/platform/tester/MergePkgsTester
> > /com/ciq/m2m/platform/tester/MergePkgsTester.class
> >
> > 2 different package names
> > ciq!=iq
> >
> > Ron
> >
> >
> > On 16/05/2010 3:41 PM, Ted Yu wrote:
> >
> >> The classes are not dynamically loaded.
> >>
> >> Thanks
> >>
> >> On Sunday, May 16, 2010, Kalpak Gadre<ka...@gmail.com> wrote:
> >>
> >>
> >>> Just in case.. Are you dynamically loading these classes from your code?
> >>>
> >>> You can see these kind of errors in case you are dynamically loading
> >>> classes using System class loader instead of the immediate class loader. The
> >>> test runner will segregate the classes by providing a custom class loader
> >>> for each test. All your classes will be added to this child class loader. So
> >>> trying to load classes from System class loader will fail as the System
> >>> class loader does not know about these classes.
> >>>
> >>> - Kalpak
> >>>
> >>>
> >>>
> >>> -rw-r--r-- 1 tyu staff 5691 May 16 08:58
> >>>
> >>> target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class
> >>>
> >>> That test passes.
> >>>
> >>> But the same problem appears for other tests:
> >>> arvindmac:m2m-platform tyu$ vi
> >>>
> >>> target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt
> >>>
> >>> java.lang.NoClassDefFoundError:
> >>> com/iq/m2m/platform/tester/MergePkgsTester
> >>>
> >>> Although the class has been generated:
> >>> ...
> >>> -rw-r--r-- 1 tyu staff 5141 May 16 08:58
> >>> target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class
> >>>
> >>> On Sun, May 16, 2010 at 7:16 AM, Anders Hammar<an...@hammar.net>
> >>> wrote:
> >>>
> >>>
> >>>
> >>> Is OtaUploadRecordReader a class you've written and that's in the same
> >>> Maven
> >>> project? If so, check that it is being compiled by checking that the
> >>> .class
> >>> file exists under target/classes/
> >>>
> >>> If it's not being compiled there's some error you need to fix in your
> >>> project.
> >>>
> >>> /Anders
> >>>
> >>> On Fri, May 14, 2010 at 19:41, Ted Yu<yu...@gmail.com> wrote:
> >>>
> >>>
> >>>
> >>> Hi,
> >>> Here is the information about maven I use:
> >>>
> >>> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
> >>> Java version: 1.6.0_17
> >>> Java home:
> >>>
> >>>
> >>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
> >>>
> >>>
> >>> Default locale: en_US, platform encoding: MacRoman
> >>> OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
> >>>
> >>> I see strange unit test failure which was due to a dependent class in the
> >>> same package not being found:
> >>> java.lang.NoClassDefFoundError:
> >>> com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
> >>> at
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
> >>>
> >>>
> >>> In Eclipse, I can successfully run the same unit test.
> >>>
> >>> Can someone provide hint ?
> >>>
> >>> Thanks
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>>
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
 		 	   		  
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

Re: unit test not finding dependent class

Posted by Ted Yu <yu...@gmail.com>.
I abbreviated the company name for privacy.
That shouldn't be the cause.

On Sun, May 16, 2010 at 2:28 PM, Ron Wheeler <rwheeler@artifact-software.com
> wrote:

> com/iq/m2m/platform/tester/MergePkgsTester
> /com/ciq/m2m/platform/tester/MergePkgsTester.class
>
> 2 different package names
> ciq!=iq
>
> Ron
>
>
> On 16/05/2010 3:41 PM, Ted Yu wrote:
>
>> The classes are not dynamically loaded.
>>
>> Thanks
>>
>> On Sunday, May 16, 2010, Kalpak Gadre<ka...@gmail.com>  wrote:
>>
>>
>>> Just in case.. Are you dynamically loading these classes from your code?
>>>
>>> You can see these kind of errors in case you are dynamically loading
>>> classes using System class loader instead of the immediate class loader. The
>>> test runner will segregate the classes by providing a custom class loader
>>> for each test. All your classes will be added to this child class loader. So
>>> trying to load classes from System class loader will fail as the System
>>> class loader does not know about these classes.
>>>
>>> - Kalpak
>>>
>>>
>>>
>>> -rw-r--r--  1 tyu  staff  5691 May 16 08:58
>>>
>>> target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class
>>>
>>> That test passes.
>>>
>>> But the same problem appears for other tests:
>>> arvindmac:m2m-platform tyu$ vi
>>>
>>> target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt
>>>
>>> java.lang.NoClassDefFoundError:
>>> com/iq/m2m/platform/tester/MergePkgsTester
>>>
>>> Although the class has been generated:
>>> ...
>>> -rw-r--r--  1 tyu  staff  5141 May 16 08:58
>>> target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class
>>>
>>> On Sun, May 16, 2010 at 7:16 AM, Anders Hammar<an...@hammar.net>
>>>  wrote:
>>>
>>>
>>>
>>> Is OtaUploadRecordReader a class you've written and that's in the same
>>> Maven
>>> project? If so, check that it is being compiled by checking that the
>>> .class
>>> file exists under target/classes/
>>>
>>> If it's not being compiled there's some error you need to fix in your
>>> project.
>>>
>>> /Anders
>>>
>>> On Fri, May 14, 2010 at 19:41, Ted Yu<yu...@gmail.com>    wrote:
>>>
>>>
>>>
>>> Hi,
>>> Here is the information about maven I use:
>>>
>>> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
>>> Java version: 1.6.0_17
>>> Java home:
>>>
>>>
>>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
>>>
>>>
>>> Default locale: en_US, platform encoding: MacRoman
>>> OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
>>>
>>> I see strange unit test failure which was due to a dependent class in the
>>> same package not being found:
>>> java.lang.NoClassDefFoundError:
>>> com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
>>>         at
>>>
>>>
>>>
>>>
>>>
>>> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
>>>
>>>
>>> In Eclipse, I can successfully run the same unit test.
>>>
>>> Can someone provide hint ?
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: unit test not finding dependent class

Posted by Ron Wheeler <rw...@artifact-software.com>.
com/iq/m2m/platform/tester/MergePkgsTester
/com/ciq/m2m/platform/tester/MergePkgsTester.class

2 different package names
ciq!=iq

Ron

On 16/05/2010 3:41 PM, Ted Yu wrote:
> The classes are not dynamically loaded.
>
> Thanks
>
> On Sunday, May 16, 2010, Kalpak Gadre<ka...@gmail.com>  wrote:
>    
>> Just in case.. Are you dynamically loading these classes from your code?
>>
>> You can see these kind of errors in case you are dynamically loading classes using System class loader instead of the immediate class loader. The test runner will segregate the classes by providing a custom class loader for each test. All your classes will be added to this child class loader. So trying to load classes from System class loader will fail as the System class loader does not know about these classes.
>>
>> - Kalpak
>>
>>
>>
>> -rw-r--r--  1 tyu  staff  5691 May 16 08:58
>> target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class
>>
>> That test passes.
>>
>> But the same problem appears for other tests:
>> arvindmac:m2m-platform tyu$ vi
>> target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt
>>
>> java.lang.NoClassDefFoundError: com/iq/m2m/platform/tester/MergePkgsTester
>>
>> Although the class has been generated:
>> ...
>> -rw-r--r--  1 tyu  staff  5141 May 16 08:58
>> target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class
>>
>> On Sun, May 16, 2010 at 7:16 AM, Anders Hammar<an...@hammar.net>    wrote:
>>
>>
>>
>> Is OtaUploadRecordReader a class you've written and that's in the same
>> Maven
>> project? If so, check that it is being compiled by checking that the .class
>> file exists under target/classes/
>>
>> If it's not being compiled there's some error you need to fix in your
>> project.
>>
>> /Anders
>>
>> On Fri, May 14, 2010 at 19:41, Ted Yu<yu...@gmail.com>    wrote:
>>
>>
>>
>> Hi,
>> Here is the information about maven I use:
>>
>> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
>> Java version: 1.6.0_17
>> Java home:
>>
>>
>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
>>
>>
>> Default locale: en_US, platform encoding: MacRoman
>> OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
>>
>> I see strange unit test failure which was due to a dependent class in the
>> same package not being found:
>> java.lang.NoClassDefFoundError:
>> com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
>>          at
>>
>>
>>
>>
>> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
>>
>>
>> In Eclipse, I can successfully run the same unit test.
>>
>> Can someone provide hint ?
>>
>> Thanks
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: unit test not finding dependent class

Posted by Ted Yu <yu...@gmail.com>.
The classes are not dynamically loaded.

Thanks

On Sunday, May 16, 2010, Kalpak Gadre <ka...@gmail.com> wrote:
> Just in case.. Are you dynamically loading these classes from your code?
>
> You can see these kind of errors in case you are dynamically loading classes using System class loader instead of the immediate class loader. The test runner will segregate the classes by providing a custom class loader for each test. All your classes will be added to this child class loader. So trying to load classes from System class loader will fail as the System class loader does not know about these classes.
>
> - Kalpak
>
>
>
> -rw-r--r--  1 tyu  staff  5691 May 16 08:58
> target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class
>
> That test passes.
>
> But the same problem appears for other tests:
> arvindmac:m2m-platform tyu$ vi
> target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt
>
> java.lang.NoClassDefFoundError: com/iq/m2m/platform/tester/MergePkgsTester
>
> Although the class has been generated:
> ...
> -rw-r--r--  1 tyu  staff  5141 May 16 08:58
> target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class
>
> On Sun, May 16, 2010 at 7:16 AM, Anders Hammar<an...@hammar.net>  wrote:
>
>
>
> Is OtaUploadRecordReader a class you've written and that's in the same
> Maven
> project? If so, check that it is being compiled by checking that the .class
> file exists under target/classes/
>
> If it's not being compiled there's some error you need to fix in your
> project.
>
> /Anders
>
> On Fri, May 14, 2010 at 19:41, Ted Yu<yu...@gmail.com>  wrote:
>
>
>
> Hi,
> Here is the information about maven I use:
>
> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
> Java version: 1.6.0_17
> Java home:
>
>
> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
>
>
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
>
> I see strange unit test failure which was due to a dependent class in the
> same package not being found:
> java.lang.NoClassDefFoundError:
> com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
>         at
>
>
>
>
> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
>
>
> In Eclipse, I can successfully run the same unit test.
>
> Can someone provide hint ?
>
> Thanks
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: unit test not finding dependent class

Posted by Kalpak Gadre <ka...@gmail.com>.
Just in case.. Are you dynamically loading these classes from your code?

You can see these kind of errors in case you are dynamically loading 
classes using System class loader instead of the immediate class loader. 
The test runner will segregate the classes by providing a custom class 
loader for each test. All your classes will be added to this child class 
loader. So trying to load classes from System class loader will fail as 
the System class loader does not know about these classes.

- Kalpak


> -rw-r--r--  1 tyu  staff  5691 May 16 08:58
> target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class
>
> That test passes.
>
> But the same problem appears for other tests:
> arvindmac:m2m-platform tyu$ vi
> target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt
>
> java.lang.NoClassDefFoundError: com/iq/m2m/platform/tester/MergePkgsTester
>
> Although the class has been generated:
> ...
> -rw-r--r--  1 tyu  staff  5141 May 16 08:58
> target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class
>
> On Sun, May 16, 2010 at 7:16 AM, Anders Hammar<an...@hammar.net>  wrote:
>
>    
>> Is OtaUploadRecordReader a class you've written and that's in the same
>> Maven
>> project? If so, check that it is being compiled by checking that the .class
>> file exists under target/classes/
>>
>> If it's not being compiled there's some error you need to fix in your
>> project.
>>
>> /Anders
>>
>> On Fri, May 14, 2010 at 19:41, Ted Yu<yu...@gmail.com>  wrote:
>>
>>      
>>> Hi,
>>> Here is the information about maven I use:
>>>
>>> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
>>> Java version: 1.6.0_17
>>> Java home:
>>>        
>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
>>      
>>> Default locale: en_US, platform encoding: MacRoman
>>> OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
>>>
>>> I see strange unit test failure which was due to a dependent class in the
>>> same package not being found:
>>> java.lang.NoClassDefFoundError:
>>> com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
>>>         at
>>>
>>>
>>>        
>> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
>>      
>>> In Eclipse, I can successfully run the same unit test.
>>>
>>> Can someone provide hint ?
>>>
>>> Thanks
>>>
>>>        
>>      
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: unit test not finding dependent class

Posted by Anders Hammar <an...@hammar.net>.
Ok, no other ideas spring to mind then. Sorry!

/Anders

On Sun, May 16, 2010 at 18:08, Ted Yu <yu...@gmail.com> wrote:

> -rw-r--r--  1 tyu  staff  5691 May 16 08:58
> target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class
>
> That test passes.
>
> But the same problem appears for other tests:
> arvindmac:m2m-platform tyu$ vi
>
> target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt
>
> java.lang.NoClassDefFoundError: com/iq/m2m/platform/tester/MergePkgsTester
>
> Although the class has been generated:
> ...
> -rw-r--r--  1 tyu  staff  5141 May 16 08:58
> target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class
>
> On Sun, May 16, 2010 at 7:16 AM, Anders Hammar <an...@hammar.net> wrote:
>
> > Is OtaUploadRecordReader a class you've written and that's in the same
> > Maven
> > project? If so, check that it is being compiled by checking that the
> .class
> > file exists under target/classes/
> >
> > If it's not being compiled there's some error you need to fix in your
> > project.
> >
> > /Anders
> >
> > On Fri, May 14, 2010 at 19:41, Ted Yu <yu...@gmail.com> wrote:
> >
> > > Hi,
> > > Here is the information about maven I use:
> > >
> > > Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
> > > Java version: 1.6.0_17
> > > Java home:
> > /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
> > > Default locale: en_US, platform encoding: MacRoman
> > > OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
> > >
> > > I see strange unit test failure which was due to a dependent class in
> the
> > > same package not being found:
> > > java.lang.NoClassDefFoundError:
> > > com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
> > >        at
> > >
> > >
> >
> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
> > >
> > > In Eclipse, I can successfully run the same unit test.
> > >
> > > Can someone provide hint ?
> > >
> > > Thanks
> > >
> >
>

Re: unit test not finding dependent class

Posted by Ted Yu <yu...@gmail.com>.
-rw-r--r--  1 tyu  staff  5691 May 16 08:58
target/classes/com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader.class

That test passes.

But the same problem appears for other tests:
arvindmac:m2m-platform tyu$ vi
target/surefire-reports/com.ciq.m2m.platform.mmp2.MeasureMergeReducerTest.txt

java.lang.NoClassDefFoundError: com/iq/m2m/platform/tester/MergePkgsTester

Although the class has been generated:
...
-rw-r--r--  1 tyu  staff  5141 May 16 08:58
target/classes/com/ciq/m2m/platform/tester/MergePkgsTester.class

On Sun, May 16, 2010 at 7:16 AM, Anders Hammar <an...@hammar.net> wrote:

> Is OtaUploadRecordReader a class you've written and that's in the same
> Maven
> project? If so, check that it is being compiled by checking that the .class
> file exists under target/classes/
>
> If it's not being compiled there's some error you need to fix in your
> project.
>
> /Anders
>
> On Fri, May 14, 2010 at 19:41, Ted Yu <yu...@gmail.com> wrote:
>
> > Hi,
> > Here is the information about maven I use:
> >
> > Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
> > Java version: 1.6.0_17
> > Java home:
> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
> > Default locale: en_US, platform encoding: MacRoman
> > OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
> >
> > I see strange unit test failure which was due to a dependent class in the
> > same package not being found:
> > java.lang.NoClassDefFoundError:
> > com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
> >        at
> >
> >
> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
> >
> > In Eclipse, I can successfully run the same unit test.
> >
> > Can someone provide hint ?
> >
> > Thanks
> >
>

Re: unit test not finding dependent class

Posted by Anders Hammar <an...@hammar.net>.
Is OtaUploadRecordReader a class you've written and that's in the same Maven
project? If so, check that it is being compiled by checking that the .class
file exists under target/classes/

If it's not being compiled there's some error you need to fix in your
project.

/Anders

On Fri, May 14, 2010 at 19:41, Ted Yu <yu...@gmail.com> wrote:

> Hi,
> Here is the information about maven I use:
>
> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
> Java version: 1.6.0_17
> Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
>
> I see strange unit test failure which was due to a dependent class in the
> same package not being found:
> java.lang.NoClassDefFoundError:
> com/ciq/m2m/platform/mmp2/input/OtaUploadRecordReader
>        at
>
> com.ciq.m2m.platform.mmp2.input.OtaUploadRecordReaderSingleFileTest.createRecordReader(OtaUploadRecordReaderSingleFileTest.java:18)
>
> In Eclipse, I can successfully run the same unit test.
>
> Can someone provide hint ?
>
> Thanks
>