• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.NoClassDefFoundError for interface of included project

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
Here's my situation:

In project 1, I include project 2 in order to use interfaces (interface A, B, C, D.....) of project 2.
For one of the interfaces, A, the system always claim java.lang.NoClassDefFoundError while others are working fine.

If I move interface A from project 2 to project 1, it works.

I named interface A "User.java", is the name the reason which causes this problem, because in interceptor setting, I have <interceptor-stack name="user">. But after I change the name, still doesn't work.

Anyone can help? Thanks very much.

Error message:
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

will zhang wrote:In project 1, I include project 2 in order to use interfaces



How do you "include" project 2? When deployed, are the required classes/interfaces in you web application's /WEB-INF/classes and jars in /WEB-INF/lib?
 
will zhang
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lorand Komaromi wrote:

will zhang wrote:In project 1, I include project 2 in order to use interfaces



How do you "include" project 2? When deployed, are the required classes/interfaces in you web application's /WEB-INF/classes and jars in /WEB-INF/lib?



I use eclipse to add project 2 to java build path of project 1. I used this method many times to include another project, it works fine.
 
will zhang
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I export project 2 as a JAR and the result is the same.
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

will zhang wrote:I export project 2 as a JAR and the result is the same.



Did you add the jar to WEB-INF/lib..?
 
will zhang
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lorand Komaromi wrote:

will zhang wrote:I export project 2 as a JAR and the result is the same.



Did you add the jar to WEB-INF/lib..?



Adding the jar into WEB-INF/lib solved the problem. Thanks!

I wonder what's the difference between putting jar in build path and putting jar in WEB-INF/lib. Appreciate!
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

will zhang wrote:I wonder what's the difference between putting jar in build path and putting jar in WEB-INF/lib. Appreciate!



If it's in the build path, Eclipse will be able to compile the project and offer its classes when you hit Ctrl+space, but if it's not in the right folder, it won't be found when your application is deployed. The latest Eclipse automatically adds the jars from WEB-INF/lib to your project's build path!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic