MyEclipse Forums
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Author Message
cherngje
Post subject: Potential solution to ClassNotFoundException  PostPosted: Nov 10, 2008 - 02:11 PM
Registered Member
Registered Member


Joined: Aug 04, 2005
Posts: 16

There is (or was) an issue with Maven4MyEclipse when use IDE to run application or JUnit test. The problem that I encountered was that when I try to run application or JUnit test by using IDE tool, I got ClassNotFoundException, however, everything is fine when using "Maven Test". I can not remember the exact steps to recreate the problem, but the problem was most likely due to Java Build Path.

If you see your project has both target and target-eclipse, it is very likely you will run into this kind of problem. What you can do is right click on the project, and then select Properties, then go to "Java Build Path". In the menu, change the default output folder to ProjectName/target/classes. If your project follows standard structure, then the output folder for ProjectName/src/main/java should be changed to ProjectName/target/classes, and the output folder for ProjectName/src/test/java should be changed to ProjectName/target/test-classes. At this point, you can delete target-eclipse folder. One thing that I need to mention is that MyEclipse doesn't create web project that follows the standard maven structure. I always change the structure and pom to follow standard maven structure, so the above steps can apply to the web project as well.

After the Java Build Path is all set, you should be able to run maven clean follow by project/clean (with build automatically enabled), then you should be able run application/JUnit test from IDE.

Maven clean will delete target folder and all the generated class files, and project/clean (with build automatically enabled) will recreate the target folder with most up-to-dated classes files.

Hope this can help.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject: RE: Potential solution to ClassNotFoundException  PostPosted: Nov 10, 2008 - 04:33 PM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23818

cherngie,

We really appreciate you taking the time to type up that solution for other folks that might be running into it (I'm stickying this thread for now). In the mean time I have forwarded the issue along to the product team for evaluation.

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
allenparslow
Post subject: RE: Potential solution to ClassNotFoundException  PostPosted: Nov 11, 2008 - 12:44 PM



Joined: Sep 25, 2008
Posts: 32

This issue looks like the same one that I'm observing: http://www.myeclipseide.com/PNphpBB2-viewtopic-t-22045.html [MyEclipse 7.0M2, maven packaging=war, JUnit don't execute].

The temporary workaround proposed by cherngje worked for me also.
 
 View user's profile Send private message  
Reply with quote Back to top
allenparslow
Post subject: RE: Potential solution to ClassNotFoundException  PostPosted: Nov 11, 2008 - 12:46 PM



Joined: Sep 25, 2008
Posts: 32

Quote:

One thing that I need to mention is that MyEclipse doesn't create web project that follows the standard maven structure. I always change the structure and pom to follow standard maven structure, so the above steps can apply to the web project as well.

I also agree.
 
 View user's profile Send private message  
Reply with quote Back to top
allenparslow
Post subject: RE: Potential solution to ClassNotFoundException  PostPosted: Dec 11, 2008 - 01:50 PM



Joined: Sep 25, 2008
Posts: 32

In MyEclipse 7.0 (release), I am able to run (from the IDE) test-classes in src/test/java with packaging-war without ClassNotFoundException without changing the java build path.

I think the issue has been resolved.
 
 View user's profile Send private message  
Reply with quote Back to top
support-rkalla
Post subject: RE: Potential solution to ClassNotFoundException  PostPosted: Dec 16, 2008 - 06:34 PM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23818

allenparslow, glad to hear it.

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits