I'm having a project in JAVA WEB and I'm having problems with hibernate. The error is as follows:
Informações: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
Informações: HHH000412: Hibernate Core {4.2.2.Final}
Informações: HHH000206: hibernate.properties not found
Informações: HHH000021: Bytecode provider name : javassist
Grave: Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/util/DTDEntityResolver
Advertência: StandardWrapperValve[ServeletLogin]: Servlet.service() for servlet ServeletLogin threw exception
java.lang.NullPointerException
at DAOs.LoginDBDAO.selectUsuario(LoginDBDAO.java:35)
at Controllers.ControllerLogin.validaUsuario(ControllerLogin.java:21)
at Servlets.ServeletLogin.doPost(ServeletLogin.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)....
Looking for google did not find anything. But I've seen people with similar problems And they always put images of the structure of the pages so go there:
Web Pages
Libraries
persistence.xml
<persistencexmlns: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_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="test" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.4.2.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>tck-utils-api</artifactId>
<version>0.9.1</version>
</dependency>
<class>Entidades.Usuario</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver" />
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/MackEstagios" />
<property name="javax.persistence.jdbc.user" value="adm" />
<property name="javax.persistence.jdbc.password" value="adm" />
<property name="hibernate.dialect" value = "org.hibernate.dialect.DerbyDialect"/>
<property name="hibernate.hbm2ddl.auto" value = "update"/>
<property name="hibernate.show_sql" value = "true"/>
</properties>
</persistence-unit>
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">
org.apache.derby.jdbc.ClientDriver
</property>
<property name="connection.url">
jdbc:derby://localhost:1527/MackEstagios
</property>
<property name="connection.username">
adm
</property>
<property name="connection.password">
adm
</property>
<property name="dialect">
org.hibernate.dialect.DerbyDialect
</property>
</session-factory>
I think the error is in the hibernate configuration and not in its implementation.
Thank you!