В данный момент занимаюсь написанием веб телефонной книги, в рамках закрепления навыков Hibernate и постепенного изучения Spring Framework. Ситуация сложилась такова, что во время деплоя варника через Tomcаt выбивает ошибку:
javax.servlet.ServletException: Servlet.init() for servlet servletController threw exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/servletController-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
java.lang.reflect.InvocationTargetException
java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
java.lang.ClassNotFoundException: javassist.util.proxy.MethodFilter
ранее с подобным не сталкивался.В чем проблема, коллеги?. Заранее благодарен... Код ключевых классов приложен.
servletController-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/mvc
https://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.0.xsd">
<mvc:annotation-driven/>
<tx:annotation-driven transaction-manager="txManager"/>
<context:component-scan base-package="ua"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/webapp/jsp"/>
<property name="suffix" value=".jsp"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="ua.model"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">create</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/postschema"/>
<property name="username" value="root"/>
</bean>
</beans>
Контроллер
@Controller
public class SSController {
Logger logger = Logger.getLogger(SSController.class);
private PostDAO postDAO;
private CategoryDAO categoryDAO;
@RequestMapping (value = "/index", method = RequestMethod.GET)
public ModelAndView allList (){
ModelAndView modelAndView = new ModelAndView();
List<Post> posts = postDAO.getAll();
List<Category> categories = categoryDAO.getAll();
modelAndView.addObject("posts", posts);
modelAndView.addObject("categories", categories);
modelAndView.setViewName("posts");
return modelAndView;
}
}
DAOImpl
public abstract class AbstractDAOImplementation<G> implements AbstractDao<G> {
@Autowired
@Qualifier(value = "sessionFactory")
private SessionFactory sessionFactory;
@Transactional
@Override
public void create(G entity) {
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(entity);
session.getTransaction().commit();
session.close();
}
@Transactional
@Override
public void delete(G entity) {
Session session = sessionFactory.openSession();
session.beginTransaction();
session.delete(entity);
session.getTransaction().commit();
session.close();
}
@Transactional
@Override
public G edit(G entity) {
Session session = sessionFactory.openSession();
session.beginTransaction();
session.saveOrUpdate(entity);
session.getTransaction().commit();
session.close();
return entity;
}
@Transactional
@Override
public G getById(long id) {
Session session = sessionFactory.openSession();
session.beginTransaction();
G entity = getEntityById(session, id);
session.getTransaction().commit();
session.close();
return entity;
}
@Transactional
@Override
public List<G> getAll() {
Session session = sessionFactory.openSession();
session.beginTransaction();
List<G> result = getAllEntity(session);
return result;
}
public abstract G getEntityById (Session session, long id);
public abstract List<G> getAllEntity(Session session);
}
PostDAO
public class PostDAO extends AbstractDAOImplementation<Post> {
@Override
public Post getEntityById(Session session, long id) {
Post result = (Post) session.createQuery("from Post where id="+id);
return result;
}
@Override
public List<Post> getAllEntity(Session session) {
List<Post> result = session.createQuery("from Post ").list();
return result;
}
}