My controller (abstract controller) is calling a service class to get a URL. In my service class I instantiate my dependency in the constructor:
the abstract controller:
public class MyPageController extends AbstractController{
private UserService userService;
private LearnerService learnerService;
private TwitterService twitterService;
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
userService = UserServiceFactory.getUserService();
learnerService = new LearnerService();
twitterService=new TwitterService();
the Service class:
public TwitterService(){
//
twitter = new Twitter();
}
but when I try to run my web app, spring throws the following error:
nested exception is java.lang.NoClassDefFoundError: twitter4j/Twitter:
java.lang.NoClassDefFoundError: twitter4j/Twitter
at com.hardwire.service.TwitterService.<init>(Twitter Service.java:21)
at com.hardwire.controller.
MyPageController.handleReq uestInternal(MyPageController.java:30)
Why does it throw this error? I don't understand. I imported the Twitter class in the service class that uses it.