In my spring mvc+hibernate+annotations project I have these three classes
UserServiceImpl.java
@Service("userService")
public class UserServiceImpl implements UserService {
@Autowired
private UserDAO userDAO;
//other codes
}
UserDAOImpl.java
@Repository("userDAO")
public class UserDAOImpl implements UserDAO {
@Autowired
private SessionFactory sessionFactory;
//other codes
}
RegistrationController.java
@Controller
@RequestMapping("/registration.htm")
public class RegistrationController {
@Autowired
private UserService userService;
//other codes
}
In my dispatcher-servlet.xml I have added the following
<context:annotation-config />
<context:component-scan base-package="com.alw.controllers,com.alw.DAOs,com.alw.services" />
and
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
When I run the project I got the following exceptions:
Error creating bean with name 'registrationController':
Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.alw.services.UserService
com.alw.controllers.RegistrationController.userService;
AND
Error creating bean with name 'sessionFactory' defined in ServletContext resource
[/WEB-INF/dispatcher-servlet.xml]:
Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError:
org/apache/commons/pool/impl/GenericObjectPool
CAN SOMEBODY POINT OUT THE WHERE I AM MISSING ?
THIS HAS TAKEN MY ENTIRE DAY TODAY.
EDIT:
I added commons.pool but no result.
I have these set of exceptions.
Error creating bean with name 'registrationController':
Error creating bean with name 'userService':
Error creating bean with name 'userDAO':
Error creating bean with name 'sessionFactory' defined in ServletContext
resource [/WEB-INF/dispatcher-servlet.xml]:
Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError:
Could not initialize class org.hibernate.cfg.AnnotationConfiguration
THANKS....