Class not Found

0 respostas
G

Ola pessoal estou aprendendo a usar o Vraptor e estou seguindo a apostila do fj28.

Pois bem na pagina 63 quando eu eu criei um ProdutosController quando eu mando ele exibir no jsp

ele me retorna o seguinte erro:

SEVERE: Exception starting filter vraptor
java.lang.NoClassDefFoundError: org/hibernate/service/config/spi/ConfigurationService

Alguem pode me ajudar ? segue o código:

@Resource
public class ProdutosController {
	
	private ProdutoDao dao;
	
	public ProdutosController() {
		dao = new ProdutoDao();
	}
	
	public List<Produto> lista() {
		return dao.listaTudo();
	}

}
@Component
public class ProdutoDao {

	private Session session;
	
	public ProdutoDao(){
		this.session = new CriadorDeSession().openSession();
	}
	
	// Adição do produto no banco de dados
	public void salva(Produto produto) {
		Transaction tx = session.beginTransaction();
		session.save(produto);
		tx.commit();
	}
	
	@SuppressWarnings("unchecked")
	public List<Produto> listaTudo() {
		return session.createCriteria(Produto.class).list();
	}

}
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<table>
		<thead>
			<tr>
				<th>Nome</th>
				<th>Descrição</th>
				<th>Preço</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${produtoList}" var="produto">
				<tr>
					<td>${produto.nome }</td>
					<td>${produto.descricao }</td>
					<td>${produto.preco }</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</body>
</html>
public class CriadorDeSession {

	private static SessionFactory getSession() {
		Configuration cfg = new Configuration().configure();
		ConfigurationService configurationService = new ConfigurationServiceImpl(
				cfg.getProperties());
		ServiceRegistryBuilder serviceRegistry = new ServiceRegistryBuilder()
				.applySettings(configurationService.getSettings());
		ServiceRegistry registry = serviceRegistry.buildServiceRegistry();
		SessionFactory factory = cfg.buildSessionFactory(registry);
		factory = cfg.buildSessionFactory(registry);

		return factory;
	}
	
	public Session openSession() {
		SessionFactory factory = getSession();
        return factory.openSession();
    }

}

Um detalhe que deve ser muito importante, quando eu mando executar como Aplicativo java(ao inves de rodar no servidor tomcat) ele funciona e ja adicionei TODOS os arquivos do hibernate na pasta lib do projeto

Criado 15 de setembro de 2012
Respostas 0
Participantes 1