Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets and JSP Chapter 3 hands-on MVC

 
Sunil Chandurkar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I compiled the servlet on page 84 but when I try to test it in the browser the error message says:

java.lang.NoClassDefFoundError: beerV1/src/com/example/model/BeerExpert
com.example.web.BeerSelect.doPost(BeerSelect.java:18)


Please advise.

Thanks
 
Bert Bates
author
Sheriff
Posts: 8905
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
let's move this to the SCWCD forum...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In BeerSelect, do you try to use a class called beerV1.src.com.example.model.BeerExpert ? If so, you may be using the wrong package. It's probably com.example.model.BeerExpert.
  • Check that BeerExpert is in com.example.model. Also check the "package" statement in BeerExpert.java (package com.example.model)
  • Check that you are importing it correctly in BeerSelect (import com.example.model.BeerExpert


  • In your web application, you proably have the following :
    WEB-INF/classes/com/example/model/BeerExpert.class
    WEB-INF/classes/com/example/web/BeerSelect.class
     
    Sunil Chandurkar
    Ranch Hand
    Posts: 37
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks for the answer. Yes, it was a directory structure and classpath situation which has been sorted out.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic