Olá pessoal,
Estou tentando desenvolver uma aplicaçãozinha básica usando JPA. Segui o exemplo do vídeo da caelum. Porém, ao chamar o meu servlet, apresenta a seguinte mensagem:
java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;
já refiz o download do Hibernate, Hibernate Annotations e EntityManager
e já coloquei todos os jars no classpath do meu projeto.
Alguem já teve este tipo de problema?
segue o persistence.xml e o servlet
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="agenda">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>models.Contato</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="none" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.hibernate_dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost/rafa" />
<property name="hibernate.connection.username" value="rafa" />
<property name="hibernate.connection.password" value="03018a" />
</properties>
</persistence-unit>
</persistence>
Servlet:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("agenda");
EntityManager em = emf.createEntityManager();
out.println("OK!");
out.close();
}
vlws.